Type: Posts; User:
(see also http://forums.sun.com/thread.jspa?threadID=5378584&tstart=0 )
Q mod P = Z
Q mod P = Z
Q mod P = Zimplies
Q - Q mod P = 0
Q - Q mod P = 0
Q - Q mod P = 0so P must be a factor of the difference of each of the values in Q, and one...
In addition to virtual calls, the compiler hasn't the opportunity to inline constants, so there's a lot more memory traffic. Comparing the current character to the literal 'A' and doing a virtual...
March 29th, 2009
March 25th, 2009
Implementations of expression grammar parsers often use the interpreter pattern. The difference between such systems and the example in the web page you cite is that the interpreter is interpreting...
A 2D array of some structure holding the data for each 'cell' (are you booking a prison?) will probably do. Quite what that structure is, and whether anything different is required to hold the data...
February 28th, 2009
There are many other parser tools - google for the names yacc, bison, antlr, rats, javacc, and I'm sure others. Too many to elaborate on without a specific question, and most of them I haven't used....
February 27th, 2009
There is an option in gcc (-fdump-translation-unit) to dump AST information, but then you have to process that yourself. The Elsa C++ parser has a direct AST interface in C++, which might be...
February 25th, 2009
Most compiler compilers or parser toolkits can be made to output a representation of an AST given the grammar of the language to be parsed. This has very little to do with profiling tools.
January 19th, 2009
Maybe, but there's no way for me to know that the variable called 'tree root' is meant to be a sub-tree rather than the tree's root. You also aren't recursing into 'tree root', but into left and...
January 16th, 2009
As written above, neither the value of p or el change during the algorithm, and you don't look at the value returned by the recursive calls to search, so it's the same as:
January 3rd, 2009
It's certainly a map of some time, and if it's implemented using hashing then it's a hash table. I'm not sure whether the advantage of your structure over either having a map/hash table of vertex to...
December 19th, 2008
Are those worst case or average?
The primary operations of a VList are:
* Locate the kth element (O(1) average, O(log n) worst-case)
* Add an element to the front of the VList (O(1)...
December 4th, 2008
Some hints, as this sounds like homework:
The first column can contain the numbers 0 to K.
Given the value in first column, how do the remaining columns look? Are they the same problem with...
November 30th, 2008
Why do you want this information?
It won't be a tree, simply because people don't always browse linearly - it is, after all, a web of hypertext not a linear document. So expect branches and...
November 27th, 2008
In order to use a std::map with arbitrary types, you supply a predicate which defines the ordering of the keys to use for the map. You could add an extra template parameter to capture the type of the...
November 21st, 2008
Sorting will tell you if an existing structure is invalid. If you are creating the structure, it's very easy to check by walking up the reports-to tree until you either get to the top (in which case...
October 25th, 2008
For small integers, just draw them on a bitmap and walk along the boundary.
Other than that, a tree or skip list where inserting a rectangle can split a node in two so that given an initial...
October 23rd, 2008
You don't want to generate combinations which are out of order, such as 6 = 2+3+1, so you pass the value you removed in the previous stage so you don't attempt to remove a value larger than it in the...
October 22nd, 2008
You also should be passing the value you remove to your recursive method, so you don't remove a value greater than it.
so you'd call part(n - t, t) for t up to n-1
part(n,r) => t + part(n-t, t)...
October 21st, 2008
This topcoder tutorial might be at the level you want.
October 18th, 2008
R-tree or other efficient rectangular spatial index using the bounding box of the circle, followed by a test whether the circles really do intersect.
October 13th, 2008
If you perform a linear scan for a fixed pointer on a 6 shaped circular list then the procedure will not terminate.
Specifically, with the circular list:
node_1 -> node_2 -> node_3 -> node_4...
October 12th, 2008
The standard way of solving it for a singly linked list was posted by Zachm. This covers cases where the list is a 6 rather than an O - it is circular (ie if you iterate over it you won't reach the...
September 1st, 2008
Click Here to Expand Forum to Full Width