data-structures

What is the underlying data structure for Python lists?

What is the typical underlying data structure used to implement Python's built-in list data type? ...

Database connection pooling datastructure

I would like to develop database connection pooling. Could anyone please tell me about which data structure need to use to maintain the pool ? ...

Visual Basic 6 data structures

What are all the build in data structures for VB6 (Microsoft Access) ? I know there are arrays, but are there other more modern data structures? ...

Section Delimiting for Flat Files

I need to generate a flat file with several different sections, each with different record structures. All data is delimited text, single line per record. What would be a good delimiting sequence, or mechanism to differentiate sections, given that records can contain line feeds etc. within quoted text fields? ...

What is the correct term for a fixed sized FIFO queue?

What is the correct name for the following data structure? It is: A queue of fixed size New elements are added to the start Whenever the queue gets above a certain size a number of elements are removed from the end ...

Are there any tools to find duplicate sections in a tree data structure?

I'm looking for a tool that finds duplicate nodes in a tree data structure (using Freemind to map the data structure, but I'll settle for anything I can export a generic data tree out too...) The idea is that I can break the tree down into modules which I can repeat thus simplifying the structure of the tree. ...

What is a good datastructure to keep cumulative values in ?

I am looking for an idea, concept or proven datastructure that would be very efficient when accessing a collection that keeps cumulative values. Example may shed more light on my need: I have a list of values (2,3,5). This list when looking at the cumulative values would be (2,5,10). I will now add 1 at the start of the list and get ...

Lookup Structure for Error Messages

I need to translate result strings from a library into exceptions. Each string has a numeric result code, followed by a pipe char, and then additional, code specific data. I'm thinking of using a custom exception with a ResultCode property, and storing a lookup table of message strings keyed by result code, which I will format with an ...

Peek at next element in a Tree set using an iterator.

I was wondering if there was a way to accomplish this, or if there are alternative data structures. It has to be sorted, without duplicates, and have an iterator. ...

Terminology/naming convention for queue operations/APIs?

The "queue", or FIFO, is one of the most common data structures, and have native implementations in many languages and frameworks. However, there seems to be little consensus as to how fundamental queue operations should be named. A survey of several popular languages show: Python: put / get C#, Qt : enqueue /dequeue Ruby, C++ STD: p...

How should I modify my Queue class to allow users to create empty queues of unspecified type in F#?

I have created an immutable Queue in F# as follows: type Queue<'a>(f : 'a list, r : 'a list) = let check = function | [], r -> Queue(List.rev r, []) | f, r -> Queue(f, r) member this.hd = match f with | [] -> failwith "empty" | hd :: tl -> hd member this.tl = match f, r...

Advice on building a fast, distributed database

Hi all – I'm currently working on a problem that involves querying a tremendous amount of data (billions of rows) and, being somewhat inexperienced with this type of thing, would love some clever advice. The data/problem looks like this: Each table has 2-5 key columns and 1 value column. Every row has a unique combination of keys. I ...

What are the best data structure for mapping strings to values?

I'm interested in an answer that explain the best in each situation. In particular which is best for: few values lots of values many values with only few extensively used read only or nearly read only map write-a-lot map fast membership without retrieval memory footprint with large value others ...

best collection object for FIFO and ability to view items by position

I'm looking for a collection object/strategy that can allow for FIFO and lets me view the items in the collection by simply specifying their position. To clarify: I would like this data structure to hold say 100 DTO objects, and then when it gets to 101, I can make room by deleting the first item, etc. (FIFO). I'd like to be able to r...

Efficient way to handle adding and removing items by bitwise And

So, suppose you have a collection of items. Each item has an identifier which can be represented using a bitfield. As a simple example, suppose your collection is: 0110, 0111, 1001, 1011, 1110, 1111 So, you then want to implement a function, Remove(bool bitval, int position). For example, a call to Remove(0, 2) would remove all items...

Any examples of production applications that use signature trees?

I've been reading a lot lately about signature trees, or S-Trees. For example, this paper. The literature speaks very highly of them, and evidence is provided for considerable performance gains over, for example, inverted files or B-Trees, for some applications. Now, why is it that I don't see S-Trees used very much? Do you know of any ...

Efficient datastructure for representing districts->states->nation relationship

Hi, I am looking for an efficient way to represent and retrieve the geographical relationship eg. districts->states->USA. This should accommodate any level of hierarchy eg. district->region->states->big region(East/west/south/north) -> USA. My requirements are I mostly operate at the lowest level - so getting all of them fast should...

Why is there no Tree<T> class in .NET?

The base class library in .NET has some excellent data structures for collections (List, Queue, Stack, Dictionary), but oddly enough it does not contain any data structures for binary trees. This is a terribly useful structure for certain algorithms, such as those that take advantage of different traversal paths. I'm looking for a correc...

Hashtables/Dictionaries that use floats/doubles

I read somewhere about other data structures similar to hashtables, dictionaries but instead of using ints, they were using floats/doubles, etc. Anyone knows what they are? ...

Does a standard implementation of a Circular List exist for C++?

I want to use a circular list. Short of implementing my own (like this person did) what are my options? Specifically what I want to do is iterate over a list of objects. When my iterator reaches the end of the list, it should automatically return to the beginning. (Yes, I realize this could be dangerous.) See Vladimir's definition ...