I am trying to come up with an algorithm to do the following:
I have total 12 cells that I need to fill until program stops. I have 3 rows and each row has 4 columns.
As an example, let me illustrate this as in airplane. So you have 3 rows and each row has 4 columns and you have window/aisle seats. Each row will have a window seat, ais...
can anyone tell me which is the best algorithm to find the value of determinant of a matrix of size nXn.
...
I'm working on a program that uses an ArrayList to store Strings. The program prompts the user with a menu and allows the user to choose an operation to perform. Such operations are adding Strings to the List, printing the entries etc. What I want to be able to do is create a method called removeDuplicates().This method will search the A...
Hi all,
I am currently working on a project where I a data matching algorithm needs to be implemented.
An external system passes in all data it knows about a customer, and the system I design has to return the customer matched. So the external system then knows the correct id of the customer plus it gets additional data or can update it...
I'm sure there's a clean way to do this, but I'm probably not using the right keywords for find it.
So let's say I have a grid. Starting from a position on the grid, return all of the grid coordinates that fall within a given distance. So I call something like:
getCoordinates( currentPosition, distance )
And for each coordinate, star...
I'm working on adding a day view option to an existing calendar solution. Like many people implementing their own calendars, I am trying to model Google Calendars. They have an excellent calendar solution and their day view provides a lot of flexibility. For most part, the implementation is going well; however, I'm having issues when ...
(I realize that my title is poor. If after reading the question you have an improvement in mind, please either edit it or tell me and I'll change it.)
I have the relatively common scenario of a job table which has 1 row for some thing that needs to be done. For example, it could be a list of emails to be sent. The table looks somethi...
Hi, for a project I need to implement a binary search. This binary search allows duplicates. I have to get all the index values that match my target. I've thought about doing it this way if a duplicate is found to be in the middle:
Target = G
Say there is this following sorted array:
B, D, E, F, G, G, G, G, G, G, Q, R S, S, Z
I get th...
I just got this question on an interview and had no idea how to calculate the answer.
How many additional function calls does fib(n) require if "LINE 3" is removed? The answer should be in terms on n.
int fib(int n) {
if(n == 0) return 0;
if(n == 1) return 1;
if(n == 2) return 1; //LINE 3 HERE <---
return fib(n - 1) + fib(n - 2...
I read about Gomoku that it can be implemented using Minimax and Alpha-Beta Pruning algorithms. So, i read these algorithms and now understand how the game will be solved. But when i sat to down to code, I am facing problem how to approach it.
As in ,
How to design the prototype functions like getNextMove or Max(Move) ?
How will the...
Possible Duplicate:
books/sites to get good at algorithm competitions
I know C and C++ and I have some experience with Java, but I don't know too much about Algorithms and Data Structures.
I did a search on Amazon, but I don't know what book should I choose. I don't want a book which put its basis only on the theoretic part; ...
I am wondering which way to reverse a string in Java that is most efficient. Should I use some sort of xor method? The easy way would be to put all the chars in a stack and put them back into a string again but I doubt that's a very efficient way to do it. And please do not tell me to use some built in function in Java. I am interested i...
I have implemented a Genetic Algorithm to solve the Traveling Salesman Problem (TSP). When I use only mutation, I find better solutions than when I add in crossover. I know that normal crossover methods do not work for TSP, so I implemented both the Ordered Crossover and the PMX Crossover methods, and both suffer from bad results.
Here...
Algorithm to generate all possible letter combinations of given string down to 2 letters
Trying to create an Anagram solver in AS3, such as this one found here:
http://homepage.ntlworld.com/adam.bozon/anagramsolver.htm
I'm having a problem wrapping my brain around generating all possible letter combinations for the various lengths of ...
I am importing massive amounts of data from Excel that have various table layouts. I have good enough table detection routines and merge cell handling, but I am running into a problem when it comes to dealing with borders. Namely performance. The bordered regions in some of these files have meaning.
Data Setup:
I am importing directly f...
Possible Duplicate:
Estimating/forecasting download completion time
We've all seen the download time running estimate that initially says something like "7 days", but keeps dropping wildly (e.g. "23 hours", "45 minutes", "1 min. 50 sec", etc) with each successive estimation as the chunks are downloaded.
To avoid these initial...
I have two folders with approximately 10,000 files each. I'd like to write a script or program that can tell me if these folders are in sync and then tell me which files are missing from each to make them in sync.
Therefore, after generating a list of files, what is the fastest algorithm to sort them for unique files? What I'm thinking...
Hello everybody,
I am trying to recreate the program in Column 15 of programming pearls using the STL. I am trying to create a suffix array using a string and a vector of indices. I record the list of words that I read in a string called input that acts as a list of words separated by ' ' that I read from stdin at the beginning of the...
Hey there, this is part of a question i got in class, im at the final stretch but this has become a major problem. In it im given a certain value which is called the "gold value" and it is 40.5, this value changes in input.
and i have these constants
const int RUBIES_PER_DIAMOND = 5; // relative values. *
const int EMERALDS_PER_RUBY ...
Dear All:
I need to generate a series of N random binary variables with a given correlation function. Let x = {xi} be a series of binary variables (taking the value 0 or 1, i running from 1 to N). The marginal probability is given Pr(xi = 1) = p, and the variables should be correlated in the following way:
Corr[ xi xj ] = const |ij| (...