I hope this isn't too vague, but I'm stuck on a problem that has put me in an Unfortunate Position.
I'm Flash developer getting my feet wet with with AS3 and am trying to build an interior decoration tool for a client. My thinking so far has been: create the basic user interface, get the screen flow down, and then finally use a couple o...
I'm trying my hand at google appengine and using the datastore with php and quercus.
I'm not familiar with Java or Python, so lots of learning going on here. I've got pages rendering, and i'm able to get data in and out of the datastore.
The app I am building has users, groups, topics and comments.
A group has users, and users can bel...
The title is mostly self-explanatory: what are the advantages of linked lists over binary trees? The only case I can think of in which a linked list is more efficient is for iterating over every element, in which case it's still pretty close. It looks like binary trees are faster at both accessing data and inserting new elements. So why ...
Assume that I have two AVL trees and that each element from the first tree is smaller then any element from the second tree. What is the most efficient way to concatenate them into one single AVL tree? I've searched everywhere but haven't found anything useful.
...
Randomized binary search trees like treap give a good performance (in the order of O(log n)) with high probability while avoiding complicated (and costly) rebalancing operations that are needed for deterministic balanced trees like AVL, red-blackm, AA, etc.
We know that if we add random keys to a simple BST, we can expect it is reasonab...
Hi,
I have a question about the following code
private void printTree(Node node){
if(node==null) return;
printTree(node.left);
System.out.print(node.data+" ");
printTree(node.right);
}
I don't really get the point of 'return;' statement there. It looks like if node is null, code returns nothing. but then without that ...
Hi guys! I have a text file where each line is a path of word strings word1/word2/.../wordn and I want to query the file. I need to build a tree which stores the words and each line of the file as a path so that anytime I search for a word, I get the word-node and all the paths this word belongs to. I was wondering if there is a build-in...
A rough definition of a data structure is that it allows you to store data and apply a set of operations on that data while preserving consistency of data before and after the operation.
However some people insist that a primitive variable like 'int' can also be considered as a data structure. I get that part where it allows you to store...
In the statement "The weighted quick-union algorithm follows at most lg N pointers to determine whether two of N objects are connected" what does lg stand for?
...
Brief background: Many (most?) modern programming languages in widespread use have at least a handful of ADTs in common, in particular, string (a (sequence comprised of characters), list (an ordered collection of values), and a map-based type (an unordered key-value store). In the R, the first two are implemented as 'character' and 'vect...
I have a list of all direct flights. From this I want to get flights from A to B with connections. What will be a suitable algorithm or data structure for this problem? Thanks.
...
What's the best way to transform an IEnumerable into a lookup- or dictionary-like structure, but with multiple keys per value?
What I'm looking for is something that does roughly the same thing as this, and in a generic way:
var wordsByLetter = new Dictionary<char, HashSet<string>>();
foreach (string word in words)
{
foreach (char l...
My understanding of calculators is that they are stack-based. When you use most calculators, if you type 1 + 2 [enter] [enter] you get 5. 1 is pushed on the stack, + is the operator, then 2 is pushed on the stack. The 1st [enter] should pop 1 and 2 off the stack, add them to get 3 then push 3 back on the stack. The 2nd [enter] shouldn't ...
Hi,
I received one question "How to delete duplicate entries from an array" Constrain: No new data structure and same array should return only distinct element. So for example If my array is 1,3,3,3,5,55,67,1 then the result should be 1,3,5,55,67
I have solved the problem
public void DeleteDuplicate(int[] array)
{
int ...
We have all read about or heard about the stack class, but many of us have probably never found a reason to use the LIFO object. I am curious to hear of real world solutions that used this object and why.
http://msdn.microsoft.com/en-us/library/system.collections.stack.aspx
I recently saw an example where a programmer used a stack to ...
Looking for an example of how to read the last semaphore count from ReleaseSemaphore
Having problems creating a basic local variable to store LPLONG lpPreviousCount
into and print out. Looks like I need a pointer to the variable but not having much luck.
If you can point me in the right direction, that would be greatly appreciated.
...
I've always used dictionaries. I write in Python.
...
I am new to data structures, and I know this is a very common question to ask. But I know LinkedList in .NET is doubly-linked, so how I will write code for a singly-linked list in C#.
Could someone please write sample code?
...
Hi All,
I got this homework. And have solved it in following way. I need your comments whether it is a good approach or I need to use any other data sturcture to solve it in better way.
public string ReturnCommon(string firstString, string scndString)
{
StringBuilder newStb = new StringBuilder();
if (firstString...
I have a large collection of custom objects that I have retrieved from a query in my system. Let's say these objects all have 5 different properties - FirstName, LastName, Gender, ZipCode and Birthday. For each of the different properties I would like to be able to get a list of all of the unique values and their counts and sort them i...