Hi
I have a 5gig text file that needs to be sorted in alphabetical order
What is the best algorithm to use?
constraints:
Speed - As fast as possible
Memory - A Pc with 1 Gig Ram running windows XP
...
I need some help with my CS homework. I need to write a sorting routine that sorts an array of length 5 using 7 comparisons in the worst case (I've proven that 7 will be needed, because of the height of the decision tree).
I considered using the decision tree 'hard-coded', but that means the algorithm is really complicated and was hinte...
I have two questions concerning fitting a gauss curve to histogram peaks.
My first question is a very basic one:
How can I fit a gauss curve to a entire histogram? Does this only mean that I have to find out and calculate the mean value(µ) and the deviation(ϭ) of the histogram and put them into the formula for the Gauss curve?
Would ...
I'm working on a higher-order theorem prover, of which unification seems to be the most difficult subproblem.
If Huet's algorithm is still considered state-of-the-art, does anyone have any links to explanations of it that are written to be understood by a programmer rather than a mathematician?
Or even any examples of where it works an...
Hi,
do you know about an effective method for extracting key sentences from a text with their frequency parameters, etc and that can also do "stemming" (search also for similar sentences) ?
I wonder also if there is some software implementation
Thanks a lot
...
Let's say I have the following code.
var numberToGetTo = 60;
var list = new[] {10, 20, 30, 40, 50};
I want to be able to return 50 & 10 from list to = 60.
If the numberToGetTo was 100 I would want to return 50, 50.
If the numberToGetTo was 85 I would want to return 50, 40.
I want to return the least amount of numbers from the list...
"In hashlife the field is typically treated as a theoretically infinite grid, with the pattern in question centered near the origin. A quadtree is used to represent the field. Given a square of 22k cells, 2k on a side, at the kth level of the tree, the hash table stores the 2k-1-by-2k-1 square of cells in the center, 2k-2 generations in ...
After having some fun in a chatbox on a certain website I had an interesting idea. What would be an algorithm that, given some input text, would generate an "echo" text from it. That is, it generates the echo that you would hear if you shouted the input text in a large empty cave. For example:
Input text: Hello!
Output text: Hello!
...
This is sort of a follow up to a question I posted earlier (http://stackoverflow.com/questions/1940980/c-algorithm-find-least-number-of-objects-necessary), but a bit different.
Given I have the following code:
var max = 80;
var list = new[]{10,20,30,40,50, 60);
I want to generate a array containing all the possible combinations I can...
quick question, I have some integrate variable in javascript, say: 123456, or 123456789, it can be any valid number. Now, I would like to convert the number to a string like "123,456" or "123,456,789". Does anyone have a good algorithm for this? Of course, it should work for any numbers. For example: for 2000 ---> 2,000; 123456--->123,45...
How can I find 2-approximate solution for a problem of determining a maximum subgraph with no cycles of an oriented graph? Subgraph is "maximum" if it contains the maximal number of edges amongst other graphs that bear the same property.
2-approximate means that we can build 2 times smaller graph than the optimal one. That's quite a b...
I'm trying to construct an algorithm that validates that a double value is a member of a range defined with min, max and step values. The problem is checking that the value obeys the step rule. For integers this can be easily done:
boolean validate(int value, int min, int step, int max){
return value >= min &&
value ...
Hi
I have problem using boost graph layout algorithmes.
boost verision 1_41_0 mingw g++ 4.4.0.
So there are issues I have encountered Can you suggest me with them?
The function fruchterman_reingold_force_directed_layout isn't compiled.
The kamada_kawai_spring_layout compiled but program crashed.
Boost documentation to layout algorith...
I have a system that stores vectors and allows a user to find the n most similar vectors to the user's query vector. That is, a user submits a vector (I call it a query vector) and my system spits out "here are the n most similar vectors." I generate the similar vectors using a KD-Tree and everything works well, but I want to do more. I ...
Given a string of numbers say "5556778", and a num N(say 2), rearrange the string such that numbers in any continuous block of size N are unique.
e.g: for the above string and N=2, one rearrangement can be 5657578.
For N=3: 5765785
find the arrangement in linear time.
...
Hello all,
Let's say there are N people and all these people have 1 basket and unlimited balls.
They can throw a ball to others' baskets.
We let them throw their balls to others' baskets and we come up with a scenario like that :
'A' person's basket
Balls from E, F, G, I, K, L, M, P
'B' person's basket
Balls from A, C, E, F, K, T, R,...
In addition to original balls and baskets problem I mentioned here : http://stackoverflow.com/questions/1948311/balls-and-baskets-problem-algorithm
There is a slightly different problem.
Still there are N people and they have unlimited balls but they dont have baskets this time.
Problem is :
There are N people with unlimited balls an...
Hi, I want to test which data structure is the best by looking at the run-time performance of my algorithm, how do I do it?
For example I already have a hashmap<string, int> hmp; assuming I have "apple" in my hashmap I want to know how long the following statement takes to execute: hmp["apple"].
How can I time it?
Thanks!
...
Hello,
I've been working on building a simple 3d graphic engine and I'm trying to find a good integer based line rasterization algorithm. ( I'm not trying to re-invent the wheel, I'm trying to get a deeper understanding of wheels).
Are there any line rasterizing algorithms that don't rely on any floating point math?
Thanks.
...
My objective is: Given a list of entries, and a desired ordering, rearrange the list of entries according to this ordering. The list will be very large, so space efficiency is important.
Ex:
List<Entry> data = ReadDataFromSomeWhere(); // data => [a, b, c];
List<int> ordering = RandomPermutation(data.Count); // ordering => [2, 1, 3];
da...