I am trying to implement a recursive splay tree, bottom up. I recurse down to the node I am need to splay up, and I find the parent and grandparent of that node. Then I am able to either zig zag or zig zig depending on the situation just fine. The problem is after this is done, I return the node which has been splayed once to the previou...
For solving spare matrices,
in general, how big does the matrix have to be (as a rule of thumb)
for methods like congraduate descent to be faster than brute force solvers (that do not take advantage o sparsity)?
...
We have a heatmap we want to display. The numbers that will make up the values being displayed are unknown (except that they will be positive integers). The range of numbers is also unknown (again, except that they will be posiitive integars). The range could be between 0 and 200 or 578 and 1M or whatever. It depends on the data, which i...
Hi everyone,
I'm looking to try to make an efficient delete method to work on a list. This situation is as follows:
Say for e.g. I have a (potentially) massive list of names:
Alex Smith
Anna Hobb
Bertie Blackman
Bill Clinton
David Smith
David Warner
George Jung
George Washington
William Wobbits
Lets say that this is a List<Person> w...
Hi All,
Thanks for stoping to read my question :) this is very sweet place full of GREAT peoples !
I have a question about "creating sentences with words". NO NO it is not about english grammar :)
Let me explain, If I have bag of words like
"person apple apple person person a eat person will apple eat hungry apple hungry"
and it can...
There are several useful answers on SO regarding prevention of brute forcing a password of a web service by applying throttling. I couldn't find any good numbers though and I have little expertise in this area, so the question is:
How many attempts does it usually take to brute-force an average password of 6 or more characters (with no ...
I'm having trouble understanding the instructions of implementing Fannkuch.
Instructions: http://www.haskell.org/haskellwiki/Shootout/Fannkuch
After step "Count the number of flips, here 5.", I am lost.
...
Hi there,
I'm trying to solve this problem : http://uva.onlinejudge.org/external/7/732.html.
For the given example, they give us the original word, for example TRIT and the target "anagramed" string, TIRT.
Objective: We have to output all the valid sequences of 'i' and 'o' (push and pop's, respectively) which produce the target string ...
I have a list of objects with property id and parent_id.
I want to build a tree to link up those children and parents.
1 parent may have several children and there is an object which will be the ancestor of all objects.
What's the fastest algorithm to implement that?
I use C# as programming language, but other languages are also okay.
...
Should the people who analyse the output and results of an algorithm be aware of its design?
By analysis I mean finding cases where the algorithm failed and returned bad results.
...
Hi,
I have a (theoretical) network with N nodes, each with their own fixed location. Each node sends one message per cycle, which needs to reach the root either directly or via other nodes.
The energy cost of sending a message from node A to node B is the distance between them, squared.
The challenge is how to link these nodes, in a ...
Are there any efficient bitwise operations I can do to get the number of set bits that an integer ends with? For example 1110 = 10112 would be two trailing 1 bits. 810 = 10002 would be 0 trailing 1 bits.
Is there a better algorithm for this than a linear search? I'm implementing a randomized skip list and using random numbers to determi...
Say I have an array of arbitrary size holding single characters. I want to compute all possible combinations of those characters up to an arbitrary length.
So lets say my array is [1, 2, 3]. The user-specified length is 2. Then the possible combinations are [11, 22, 33, 12, 13, 23, 21, 31, 32].
I'm having real trouble finding a suitabl...
I am looking for a algorithm that takes a string and splits it into a certain number of parts. These parts shall contain complete words (so whitespaces are used to split the string) and the parts shall be of nearly the same length, or contain the longest possible parts.
I know it is not that hard to code a function that can do what I wa...
I would really like to know how web sites decide what ad to show to a user and how many times.
I think there must be a table Ads (id, url, ...) which is linked to a table Users by many to many relationship via table Ads2Users (ad_id, user_id, shown_count, clicked_count). So that each time a user is served a particular ad we find (or c...
What is the name of the following method/technique (I'll try to describe the best I could, background on "memoization" is probably needed to understand why this technique can be very useful):
You start some potentially lenghty asynchronous computation and you realize that an identical computation has already been started but is not done...
I'd like to convert the output of diff (on a Markdown file) to
Markdown with <strike> and <em> tags, so that I can see what has
been removed from or added to a new version of a document. (This kind of
treatment is very common for legal documents.)
Example of hoped-for output:
Why do weWe study programming languages? notNot in ord...
I'm looking to calculate entropy and mutual information a huge number of times in performance-critical code. As an intermediate step, I need to count the number of occurrences of each value. For example:
uint[] myArray = [1,1,2,1,4,5,2];
uint[] occurrences = countOccurrences(myArray);
// Occurrences == [3, 2, 1, 1] or some permutation...
If I have a 32-bit binary number and I want to replace the lower 16-bit of the binary number with a 16-bit number that I have and keep the upper 16-bit of that number to produce a new binary number.. how can I do this using simple bitwise operator?
For example the 32-bit binary number is:
1010 0000 1011 1111 0100 1000 1010 1001
and ...
What Big-O complexity have most widespread algorithms for the basic arithmetic operations like multiplication, square root, logarithm, scalar and matrix product?
Do exist some exotic algorithms which are the most effective in terms of Big-O complexity but for some reasons not very widespread in practical solutions (e.g. not implemented i...