Let's say I have a 500x500 2D grid (from -250 to 250). Each cell of the grid has a certain value, from 0 to 100. What I've been trying to do is keep a list of all the cell with a value lower than 50 starting at the point (0, 0), but I would like not
I have a requirement in one of my J2EE project, where I have to pre-process data based on some business logic and formulate it into data structure (may be in memory database table) so I can use result by keeping look up into that data structure for p
This question already has an answer here: Algorithm: Extract subset based on property sum 4 answers I have an array such as below: int[] numberArray = {9,2,1,5,6}; I want to devise a method that will take an integer as an argument and return true/fal
I'm writing a program that reads a general HTML "article" page (Wikipedia, NY Times, Yahoo News, ect). From that page I want to strip away all of the "noise" (ads, header bars.. anything that isn't part of the article content.) To thin
I have a long string 'str' and a list of a triplets in the form [start, end, replace_str]. I need to iterate through the list of triplets and replace the contents of 'str' between start and end indices by replace_str. The replace_str string can be of
I have a code that generates all of the possible combinations of 4 integers between 0 and 36. This will be 37^4 numbers = 1874161. My code is written in MATLAB: i=0; for a = 0:36 for b= 0:36 for c = 0:36 for d = 0:36 i=i+1; combination(i,:) = [a,b,c,
I need to group addresses given their distances. Let's say I have a list of 8 addresses. 5 in NYC and 3 in New Jersey. From those 5 in NYC 3 are close to the MET and 2 to the WTC. Those 3 in NJ would form one group, those close to the MET another and
There was a problem in cracking the coding interview -part V Question 11.7 and the solution I am trying to implement here is their solution in Java converted to C++.But I am facing issue of segmentation fault. #include<iostream> #include<vector&g
Say we have two english texts T1 and T2 (disjoint no overlap ) cut out from a larger text T. Is there a way to figure out that T1 and T2 came from a single larger text? For example , newspaper layout is in multi column text. Given two column of text
I'm trying to find a suitable DP algorithm for simplifying a string. For example I have a string a b a b and a list of rules a b -> b a b -> c b a -> a c c -> b The purpose is to get all single chars that can be received from the given string
I have a grid (an NSArray of CGPoints)where I want to layout some objects at points based on some constraints. This is what I know: How big the grid is The number of objects that have to be laid out on the grid, at a point The minimum distance betwee
Everyone knows of the cracker barrel triangle peg solitare game. You take one peg and jump it over another into an empty hole and the goal is to have only one peg left. In my code for the game board object I have a function sCpeg(int a, int b) which
When I run my code my out put is this ----jGRASP exec: java AgeClientFL Enter birth day: 5 Enter birth month: 5 Enter birth year: 5 Birth: 5/5/5 Today: 1/1/0 Age: 0 Michaels Birth: 5/7/1995 Milestone: 5/7/2016 Age at Milestone: 0 ----jGRASP: operatio
I have a non directed graph that is connected. I want to make it bi-connected by adding minimum number of edges. How can i do it? I tried searching online for this particular algorithm and also tried thinking myself without success. Please help me un
I have a set of objects (rectangles having 4 vertices of (X,Y) each) draw on a map using OpenGL ES. I would want to implement way finding between each of them. For example I have rectangles A,B,C,D,E Structure: A[Vertex(X,Y),Vertex(X,Y),Vertex(X,Y),V
I am trying to implement a randomly generated maze using Prim's algorithm. I want my maze to look like this: however the mazes that I am generating from my program look like this: I'm currently stuck on correctly implementing the steps highlighted in
Let's say you have a text file that contains a few encrypted words. You don't know the encryption algorithm, but you know that the method that the encryption uses its just replacing every letter with another one. Lets say we've got a regular word, 'S
Context I have an application that selects a weighted random entry from a table for which prefix summation (of weights) is a crucial part. The simplified table definition looks like this: CREATE TABLE entries ( id INT NOT NULL PRIMARY KEY AUTO_INCREM
I literally tried everything, tried every solution but it still won't work. It seems like Hoare partition works only in certain cases but once in a while i don't even understand what it is doing. Yes, I know how the algorithm works, but implementatio
I am constructing a btree from some data. Once I construct the btree (i.e. insert all the elements) I no longer insert or remove elements. However the resulting btree is not optimal in a sense that if I can have n maximum elements per node very frequ