Hi,
I have a fewSortedList<>andSortedDictionary<>structures in my simulation code and I add millions of items in them over time. The problem is that the garbage collector does not deallocate quickly enough memory so there is a huge hit on the application's performance. My last option was to engage theGC.Collect()method so that I can rec...
Hey guys!
Friend of mine got asked the following question in an interview recently and im looking for a definitive answer for him.
How is the hash value of an object stored in a dictionary?
Cheers in advance!
...
Suppose a table with two columns: From and To. Example:
From To
1 2
2 3
2 4
4 5
I would like to know the most effective way to locate all nodes that are reachable from a node using a SQL Query. Example: given 1 it would return 2,3,4 and 5. It is possible to use several queries united by UNION clauses but it would limit the...
Hey guys,
I'm trying to display my results from a CFQuery in a specific order. The order is to be maintained in the database so that it can be manipulated, and there are an unknown number of columns per table. The final row in the table is "ColumnOrder": each column has a number to specify it's sort order, 0 means "don't display". I'm t...
I am looking for solution for :
Given a array and a number P , find two numbers in array whose product equals P.
Looking for solution better than O(n*2) . I am okay with using extra space or other datastructure .Any help is appreciated ?
...
The title is a bit confusing, so i will explain a bit more using examples. Just a note: i am parsing a file format. Say we have a structure like this:
struct example
{
typeA a;
typeB b;
typeX x;
typeY y;
typeZ z;
};
So far its ok. Now the problem is, that typeX, typeY and typeZ can vary in size. Depending on flags in th...
I have an interesting problem.
I have a very large (larger than 300MB, more than 10,000,000 lines/rows in the file) CSV file with time series data points inside. Every month I get a new CSV file that is almost the same as the previous file, except for a few new lines have been added and/or removed and perhaps a couple of lines have been...
Hi,
What is the best data-structure for doing following operation quickly
Insert
Find.
Thanks
Avinash
...
I've trying to submit html emails to amazon's mechanical turk using the questionform xml data scheme. I'm having issues converting the html emails into well formed html data. I just input a script to grab it from my table and print the data inside the tags of the html email, but as you can see below, it's terribly formed and will not...
I had once known of a way to use logarithms to move from one leaf of a tree to the next "in-order" leaf of a tree. I think it involved taking a position value (rank?) of the "current" leaf and using it as a seed for a fresh traversal from the root down to the new target leaf - all the way using a log function test to determine whether t...
What are the real world applications of Fibonacci heaps and binary heaps? It'd be great if you could share some instance when you used it to solve a problem.
EDITED: Added binary heaps also. Curious to know.
...
I'm using a type Id which is defined in another part of the code I'm using:
typedef int Id;
Now I am provided many objects, each of which comes with such an Id, and I would like to use the Id as index into a std::vector that stores these objects. It may look something like this:
std::vector<SomeObj*> vec(size);
std::pair<Id, SomeObj*...
I am looking for the perfect data structure for the following scenario:
I have an index i, and for each one I need to support the following operation 1: Quickly look up its Foo objects (see below), each of which is associated with a double value.
So I did this:
struct Foo {
int a, b, c;
};
typedef std::map<Foo, double> VecElem;
std...
Do linked lists have any practical uses at all. Many computer science books compare them to arrays and say the main advantage is that they are mutable. However, most languages provide mutable versions of arrays. So do linked lists have any actual uses in the real world, or are they just part of computer science theory?
...
I'm planning to store player stats in a database for a game, and need to find a suitable data structure for testing against them in the code. The structure needs to work well in php, but I'm interested in any ideas for learning purposes.
In this first iteration of pseudo-code, I'm imagining multi-dimensional arrays for the data-structu...
It is written everywhere that data in SQL Server is written in pages of 8K (8192 B) each with 8060 bytes for data and the rest is overhead (system info).
Though, the recent article [1] gives code example illustrating, as I understood, that 8078 bytes of data fit into a page.
What do I miss in understanding 8,060 B per per page?
I ve...
I need a data-structure, which supports the following operations both memory and time-efficient, it can be assumed, that the value has an ordering.
Add a value to the structure
Find out, whether a value is in the structure
Plus, the structure has to be immutable, because I want to use Haskell.
If I would not assume immutability, pro...
I want to understand how huge graphs can be implemented, so that graph algorithms run faster with huge graphs.
...
What do we mean by length of binary tree - number of nodes, or height of tree?
Thank you
...
I'm preparing for a job interview. I was stuck at one of the binary tree questions:
How can we calculate the sum of the values present in all the nodes of a binary tree?
Thanks in advance.
...