I have a speed critical multithreaded program which involves data in a tree structure. Implemented as follows:
typedef struct
{
// data pertaining to linkages, defining the architecture of the tree
int parent_node;
int child_node[MAX_CHILD_NODES];
int number_of_children;
// data pertaining to info at each node
f...
I am very new to Python, and trying to figure out how to create an object that has values that are accessible either by attribute name, or by index. For example, the way os.stat() returns a stat_result or pwd.getpwnam() returns a struct_passwd.
In trying to figure it out, I've only come across C implementations of the above types. No...
Hi,
I have a method which returns an array of fixed type objects (let's say MyObject).
The method creates a new empty Stack<MyObject>. Then, it does some work and pushes some number of MyObjects to the end of the Stack. Finally, it returns the Stack.ToArray().
It does not change already added items or their properties, nor remove them...
Hello
Is it possible to return multiple JSON objects in the request header with Struts1? I am presently returning a single JSON objects, however the need now is to return a second data structure. All the client-side processing works perfectly for the single data structure in the single JSON objects, I really do not want to complicate it...
I am working on this project where I need to read in a lot of data from .dat files and use the data to perform simulations. The data in my .dat file looks as follows:
DeviceID InteractingDeviceID InteractionStartTime InteractionEndTime
1 2 1101 1105
1,2 1101 and 1105 are tab delimited and ...
I'm looking for for a programming book that reviews basic concepts like implementing linked lists, stacks, queues, hash tables, tree traversals, search algorithms, etc. etc. Basically, I'm looking for a review of everything I learned in college but have forgotten. I prefer something written in the last few years that includes at least a ...
I'm looking for a decent implementation of a set data structure in JavaScript. It should be able to support elements that are plain JavaScript objects.
So far I only found Closure Library's structs.Set, but I don't like the fact that it modifies my data.
Any ideas?
...
i have a data structure for my compiler (such as ast) , and i need a method to print it (like ms visio) and verify its contents (i need to verify the contents of the ast nodes)
note : i dont want to print it to the console , i am using c++ & qt
thanks
...
I am trying to declare a private Data Structure such as the Vector in my C++ header file which I want to eventually use within the method implementation of my .cpp.
An example would be my header "SomeClass.h" where I have:
class SomeClass
{
private:
Vector<T> myVector;
public:
void AddTtoMyVector(T add);
}
And in my .cpp whic...
Problem statement:
We have equal number of men and women. Each man has a preference score toward each woman. So do the woman for each man. Each of the men and women have certain interests. Based on the interest, we calculate the preference scores.
So initially, we have an input in a file having x columns. The first column is the person...
I think that the zipper is a beautiful idea; it elegantly provides a way to walk a list or tree and make what appear to be local updates in a functional way.
Asymptotically, the costs appear to be reasonable. But traversing the data structure requires memory allocation at each iteration, where a normal list or tree traversal is just po...
When you search in Google "100F to C" how does it know to convert from Fahrenheit to Celsius? Similarly, conversion from different currencies and simple calculation.
What is the data structure used, or is it simple pattern matching the strings?
...
Given a dictionary of words and an initial character. find the longest possible word in the dictionary by successively adding a character to the word. At any given instance the word should be valid word in the dictionary.
ex : a -> at -> cat -> cart -> chart ....
...
I want to implement a Set in C.
Is it OK to use a linked list, when creating the SET, or should I use another approach ?
How do you usually implement your own set (if needed).
NOTE:
If I use the Linked List approach, I will probably have the following complexities for Set my operations:
init : O(1);
destroy: O(n);
insert: O(n);
remo...
Windows Live Messenger creates a number of files like
C:\Users\USERNAME\AppData\Local\Microsoft\Windows Live Contacts{ae86acef-5a45-4447-bc32-521fc9289e1a}\DBStore\contacts.edb
and stores contacts within. When looking on such files, it is obviouos that they have strict structure. However, I failed to find the description of contacts.ed...
I am currently working on a project that extensively relies on the EAV model. Both entities as their attributes are individually represented by a model, sometimes extending other models (or at least, base models).
This has worked quite well so far since most areas of the application only rely on filtered sets of entities, and not the en...
Hi,
I only know that the difference between hashmap and map is that hashmap is implemented with hash function but map is implemented with tree. Could any body add anything more?
Based on this, is there any thing hashmap can do but map cannot?
...
I was wondering how does one decide the resizing factor by which dynamic array resizes ?
On wikipedia and else where I have always seen the number of elements being increased by a factor of 2? Why 2? Why not 3? how does one decide this factor ? IF it is language dependent I would like to know this for Java.
...
Scenario
I have the following methods:
public void AddItemSecurity(int itemId, int[] userIds)
public int[] GetValidItemIds(int userId)
Initially I'm thinking storage on the form:
itemId -> userId, userId, userId
and
userId -> itemId, itemId, itemId
AddItemSecurity is based on how I get data from a third party API, GetValidItemI...
BIG EDIT:
Ok, my original question didn't help me. Here is a second go.
My struct looks like this:
struct node {
char *name;
int age;
struct node *nextName;
struct node *nextAge;
};
I have to make two linked lists out of structures like this,.
So i have 'rootAges' which keeps track of where the Age-based list starts an...