data-structures

Holding onto items after a postback

I have an ASP.NET web application and I want to be able to take items from a master list and store them temporarliy into one of four other lists. The 'other' lists need to survive post backs so that more items can be added to them. What direction would you suggest going with? I have thought of using a generic list stored in memory, tem...

DataStructure Stack

What does a Push operation on a stack return? ...

record duplication in c++

hey i want to know if anyone can tell me how to delete duplicate records or avoid duplication in the first place.... the problem is that whenever i edit a record, a duplicate record is created. can anyone please send an answer?? ...

Why isn't randomized probing more popular in hash table implementations?

According to various sources, such as Wikipedia and various .edu websites found by Google, the most common ways for a hash table to resolve collisions are linear or quadratic probing and chaining. Randomized probing is briefly mentioned but not given much attention. I've implemented a hash table that uses randomized probing to resolve ...

Java large datastructure for storing a matrix

Hi folks, I need to store a 2d matrix containing zip codes and the distance in km between each one of them. My client has an application that calculates the distances which are then stored in an Excel file. Currently, there are 952 places. So the matrix would have 952x952 = 906304 entries. I tried to map this into a HashMap[Integer, Fl...

What Data Structures are available in the Linux Kernel

Is there a list somewhere of all the major generic data structures used in the Linux Kernel and as a side bonus major places they're used? What I mean by "generic data structures" is things like doubly linked lists, hash lists, timer wheels, etc. Also, which ones are considered part of the internally provided api available to modules...

C# - Populate Data Structure At Runtime With References To Buttons Added To TableLayoutPanel At Design Time

Hello folks, I am using Visual C# 2008 Express edition. If at design time I have a form [myMainForm], to which I have added a TabControl [myTabControl], and myTabControl has a single tabPage [myTabPage], and to this tabPage I have added a tableLayoutPanel [myTableLayoutPanel], and to myTablelayoutPanel I have added ten buttons (button1...

Looking for a disk-based B+ tree implementation in C++ or C

Hi, I am looking for a lightweight open source paging B+ tree implementation that uses a disk file for storing the tree. So far I have found only memory-based implementations, or something that has dependency on QT (?!) and does not even compile. Modern C++ is preferred, but C will do too. I prefer to avoid full embeddable DBMS solut...

Implement an array of stacks in C

Implement an array of stacks where stacks are defined : typedef struct StackNode { int data; StackNode* next; } StackNode; Each array element points to a stack, each stack is initialized as an empty stack. When you start adding elements it will start adding them to the stack in Stacks[0]; if you say -2 in stdin and then 4 for...

C: deep copying - structure with a void pointer

Hi, I've got a following struct struct teststruct { int *a; void *data; }; Is it possible to do a deep copy of structure which contains a void pointer? I assume that I cannot tell how many bytes data pointer points to? So I cannot malloc specified number of bytes and do memcpy. Am I right? ...

Add to a hashtable

I am trying to implement a hash table ...

Collection of sets containing no sets which are a subset of another in the collection

I am looking for an abstract data structure which represents a collection of sets such that no set in the collection is a subset of another set in the collection. This means that on insert the following conditions will be met: A. Inserting an element that is already a subset of another element will return the original collection. B. I...

C++ Data Structure for storing 3 dimensions of floats.

I've implemented a 3D strange attractor explorer which gives float XYZ outputs in the range 0-100, I now want to implement a colouring function for it based upon the displacement between two successive outputs. I'm not sure of the data structure to use to store the colour values for each point, using a 3D array I'm limited to rounding t...

A collection that represents a concatenation of two collections in Java

Is there a class that represents the concatenation of a collection with another collection? This class should be a Collection in itself, and should delegate all methods to the underlying (inner) collections - no extra memory should be allocated, nor any of the original collections modified. Example usage: Collection<String> foo = ... C...

Linked List Ocaml

How would i create a linked list to hold my data in Ocaml? Im trying to make a singly linked list, however im having trouble with the syntax. I just want to make a module to simply get the 'a from the linked list, insert 'a or delete 'a. Anyone have any idea? Thanks, Faisal Abid ...

Iterating over binary tree w/o control of stack or dynamic allocation

Is there an efficient, practical way to iterate over a binary tree given the following constraints: You do not have control of the call stack, and thus may not use recursion. All state must live inside the iterator/range object, not on the stack. No heap allocations may be used anywhere in the algorithm. The tree may be immutable, and...

Efficient queue in Haskell.

How can I efficiently implement a list data structure where I can have 2 views to the head and end of the list, that always point to a head a tail of a list without expensive calls to reverse. i.e: start x = [] end x = reverse start -- [] start1 = [1,2,3] ++ start end start1 -- [3,2,1] end should be able to do this without invoking 'r...

What is the proper syntax for storing an array into a Perl hash?

I'm creating a new object like this: TestObject->new(@array1, @array2) My new method looks like this: sub new { my $class = shift; my $self = {}; my $self->{Array1} = shift; my $self->{Array2} = shift; bless($self, $class); return $self; } As a simple test to access the data, I'm trying this, and then once I get it w...

handling data structures (hashes etc) gracefully in ruby

I recently did a class assignment where I made a really hacky data structure. I ended up using nested hashes, which seems like a good idea, but is really hard to iterate through and manage. I was doing general stuff, like one tag maps to a hash of items that map to prices and stuff like that. But some of them were getting more complicat...

What's A QT Or Open Source C++ Template For Ordinal Sorting

Hi, I am looking for a special template class, hopefully either a QT template or a self-contained open source library. This template class is intended to act as a container for a set of objects. Each object in the set has an integer-valued weight function but the weight function itself is arbitrary. It could range uniformly from 10 to ...