I need a collection data-structure that can do the following:
Be sorted
Allow me to quickly pop values off the front and back of the list O(log n)
Remain sorted after I insert a new value
Allow a user-specified comparison function, as I will be storing tuples and want to sort on a particular value
Thread-safety is not required
Optiona...
Hi,
I have to search a 25 GB corpus of wikipedia for a single word. I used grep but it takes lot of time. Is there a efficient and easy representation that can be made to search quickly. Also, I want to find exact match.
Thank you.
...
Possible Duplicate:
Why are two different concepts both called heap?
Is the heap one uses as a data structure (complete binary tree) in Computer Science the same type of heap used in memory where objects are allocated?
...
Currently in my application I have a single table that is giving me a bit of trouble. The issue at hand is I have a value object that is mapped to this table. When the data is returned to me as an array of value objects, I have to then loop through this array and begin my recursion by matching the ParentID to parent ObjectID's.
The col...
I need to have a buffered char stream, into which I write in one thread and from which I read in another thread. Right now I'm using PipedReader and PipedWriter for it, but those classes cause a performance problem: PipedReader does a wait(1000) when its internal buffer is empty, which causes my application to lag visibly.
Would there b...
This is less of a code-specific question and more of an Objective-C nomenclature question. In C you have struct for pure data. In Enterprise Java, you have "bean" classes that are purely member variables with getters and setters, but no business logic. In Adobe FLEX, you have "Value Objects".
In Objective-C, is there a proper name ...
How wil you convert Binary Tree to Binary Search Tree with O(1) extra space ?
...
I'm trying to calculate somebody's bowel health based on a points system. I can edit the data structure, or logic in any way. I'm just trying to write a function and data structure to handle this ability.
Pseudo calculator function:
// Bowel health calculator
var points = 0;
If age is from 30 and 34:
points += 1
If age is from 35 ...
I am working on a tree component and I am having a bit of the issue with populating the data-provider for this tree.
The data that I get back from my database is a simple array of value objects. Each value object has 2 properties. ObjectID and ParentID. For parents the ParentID is null and for children the ParentID is the ObjectID of th...
When sending data to a stored procedure through SubSonic, how can I pass a dbtype.structure?
I have a TVP defined as READONLY, and when SubSonic generates the StoredProcedures.cs file, the parameter shows up as a string type.
What is the way to accomplish this?
Thank you.
...
i need to write a program that counts the number of nodes from a certain level given in binary
tree
i mean < numberofnodes(int level){} >
i tried writing it without any success because i don't how to get to a certain level then go
to count number of nodes
...
What can I do with Mapreduce? Dictionaries? Lists? What do I use it for? Give a real easy example
...
I need to create a hash table that has a key as a string, and value as an int. I cannot use STL containers on my target. Is there a suitable hash table class for this purpose?
...
How is a hash of integer array can be represented in objective-c? Here is the ruby hash as an example:
hi_scores = { "John" => [1, 1000],
"Mary" => [2, 8000],
"Bob" => [5, 2000] }
such that can be accessed by:
puts hi_scores["Mary"][1]
=> 8000
hopefully easy to serialize too. Thanks!
...
Hi,
I have an object model whose structure is
Dashboard List of panels
List of containers
List of widgets
If i get whole dashboard, with panels + containers + widgets, from Database then multiple I/O requires
I want to get it in one I/O .For this i prepared a query which gives me this resultset.
DA...
I need to store data in memory where I map one or more key strings to an object, as follows:
"green", "blue" -> object1
"red", "yellow" -> object2
So, in Java the datastructure might implement:
Map<Set<String>, V>
I need to be able to efficiently receive a list of objects, where the strings match some boolean criteria, such as:
("...
I realize that what I am trying to do isn't safe. But I am just doing some testing and image processing so my focus here is on speed.
Right now this code gives me the corresponding bytes for a 32-bit pixel value type.
struct Pixel {
unsigned char b,g,r,a;
};
I wanted to check if I have a pixel that is under a certain value (e.g...
What is the difference between a Map and a Dictionary? I am not asking for how they are defined in language X or Y(which seems to be what generally people are asking here on SO), I want to know what is their difference in theory.
I know a Map is an object that maps keys to values. Isn't a Dictionary the same?
Thanks
...
What are some clever (not ordinary) ways of implementing data structures in C, and what are some data structures that should be used more often?
For example, what is the most effective way (generating minimal overhead) to implement a directed and cyclic graph with weighted edges in C?
I know that we can store the distances in an array a...
Hi,
The situation is as follows:-
We have n number and we have print
them in sorted order. We have access
to balanced dictionary data structure,
which supports the operations serach,
insert, delete, minimum, maximum each
in O(log n) time.
We want to retrieve the numbers in
sorted order in O(n log n) time using
onl...