data-structures

What is the best data structure to use for an offspring relationship?

There must be a standard data structure to hold, for instance, dog breeding information, plant genetic crossbreeding, and complex human relationships. One might think it would be an easy tree structure, but the combination of two (or more, for genetic engineering) parents per offspring, multiple different offspring per parent set, multi...

In place min-max tree invalidation problems

I’m trying to build a parallel implementation of a min-max search. My current approach is to materialize the tree to a small depth and then do the normal thing from each of these nodes. The simple way to do this is to compute the heuristic value for each leaf and then sweep up and compute the min/max. The problem is that it this omits a...

Are there any open source C libraries with common data structures?

I'm looking for a C library with common reusable data structures like linked lists, hash tables etc. Something like the source distributed with Mastering Algorithms with C (Paperback) by Kyle Loudon. ...

What are real world examples of when Linked Lists should be used?

Another programmer was mentioning that they haven't found a use case for using a linked list data structure in any professional software in his career. I couldn't think of any good examples off the top of my head. He is mostly a C# and Java developer Can anyone give some examples where this was the correct data structure to solve a pa...

Best data structure in C for these two situations?

I kinda need to decide on this to see if I can achieve it in a couple of hours before the deadline for my school project is due but I don't understand much about data structures and I need suggestions... There's 2 things I need to do, they will probably use different data structures. I need a data structure to hold profile records. Th...

what is "stack alignment"?

What is stack alignment? Why is it used? Can it be controlled by compiler settings? The details of this question are taken from a problem faced when trying to use ffmpeg libraries with msvc, however what I'm really interested in is an explanation of what is "stack alignment". The Details: When runnig my msvc complied program which ...

Help me turn these data structures into database tables

It's been a while since I've last tinkered with databases, and as usually my mind has slipped on what I need to do. Here's me problem: I have a list of entries (strings). Each entry has its own name and unique ID. Entries can share names, but not IDs. Entries can also have properties (strings). Entries can have more than one of the sa...

What's a good data structure for building equivalence classes on nodes of a tree?

I'm looking for a good data structure to build equivalence classes on nodes of a tree. In an ideal structure, the following operations should be fast (O(1)/O(n) as appropriate) and easy (no paragraphs of mystery code): (A) Walk the tree from the root; on each node --> child transition enumerate all the equivalent versions of the child...

Corner Stitching Datastructure, Any Open Source Implementations?

I recall learning about the corner-stitched data structure a number of years ago and have been fascinated with it ever since. It originated with a paper by Ousterhout. I've searched and not been able to find a free/open implementations. I'd prefer a C++ implementation, but at this point would accept any pointers people might have. No...

Fetching linked list in MySQL database

I have a MySQL database table with this structure: table id INT NOT NULL PRIMARY KEY data .. next_id INT NULL I need to fetch the data in order of the linked list. For example, given this data: id | next_id ----+--------- 1 | 2 2 | 4 3 | 9 4 | 3 9 | NULL I need to fetch the rows fo...

Are data structures used in higher level languages?

Hello, I am currently still in school and taking a class on implementing data structures in c++. In my spare time I enjoy programming in "higher level" languages (mostly Ruby with some c#). So since these higher level languages manage the memory for you, what would you use data structures for? I can understand the need for queues and st...

What is the degree of a tree? (As in, a tree ADT)

I understand that the degree of a node is the number of children it has. However, how do we define the degree of a tree? ...

Declaring structures within functions in C

I have a structure that only one function must access. The function converts tokens like "k, K, kb, KB, m, M, mb, MB, ..." into an actual unit. The purpose of this is to simplify a configuration file. So, suppose we have: static uint32_t real_unit(const char *str) { struct u2type { char key[3]; uint32_t val; } const...

How can one implement a Compact Directed Acyclic Word Graph (CDAWG) in C?

How would one implement this data structure in C. It is a structure similar to the DAWG, that is more efficient than the trie which only compresses prefixes. The CDAWG is a data structure twice as space efficient as the DAWG. ...

Effectively Design a Simple Mail Client

Requirement : JAVA desktop mail client which could connect to existing gmail,y! mail a/c & will allow receive/send mails, support offline view of mails, plus with more features as & when it comes. i am using Java Mail Api's Underlying Mail Storage: I have decided to use HSQLDB with Hibernate. Email content can have attachments , HTML ...

Fast sampling and update of weighted items (data structure like red-black trees?)

What is the appropriate data structure for this task? I have a set of N items. N is large. Each item has a positive weight value associated with it. I would like to do the following, quickly: inner loop: Sample an item, according it its weight. [process...] Update the weight of K items, where K << N. When I say sample ...

What is a good 'Data Structures' textbook?

Next semester I'm going to be teaching my first Computer Science course: Data Structures. Can anyone suggest one of the better textbooks for this topic so I can have some extra input when ordering the books for the class? I have no language requirements imposed on me, so I can teach the course in any language I choose. So, it doesn't ...

How can I search a graph for a path?

Say I have a list of edges each containing two nodes (to and from). What is the best way to find the edge two given nodes? Note that nodes in the edge may repeat. Say I have edge in this format: 1 <-> 5 3 <-> 7 5 <-> 6 2<-> 6 Then query such as 1 5 will return true. Then query such as 5 2 will return true because...

What data structure is most suitable for implementing a 2-D array in Java?

I want to implement a 2-D array kind of a thing. What data structure will be most suitable for this? An array or some other data-structure will do. If there is any other data structure which will satisfy my requirement, then please tell me. I don't want to use an array because the 2-D array needs to be declared early in the program but...

What data structure should I use to keep track of recently used items?

I need something like a bounded queue where I can only insert say 10 elements. A new element should override the last inserted element. There should be only n distinct elements I am looking for suggestions in Java by the way. ...