data-structures

I'm completely stumped: checking two tables against eachother in MySQL query

I feel like I'm writing a word problem, but it's really puzzling me and I really hope someone here can solve it: I want to select one row from table A. Table A includes the attributes Name and Number. But before I finish the query, I want to check it against table B. Table B includes Name, Number, and the Username of the user. Based on ...

Data structure for string indices?

I'm looking for a data structure for string(UTF-8) indices that is highly optimized for range queries and space usage. Thanks! Elaboration: I have list of arbitrary length utf-8 strings that i need to index. I will be use only range queries. Example: I have strings - apple, ape, black, cool, dark. Query will be something like this -...

Dynamically Storing and retriving 3,000,000+words in c#.NET using Collections

How to Store and retrieve 3,000,000+ words in Dynamically without using SQL.. Get a word form a document then check whether the word is available or not. if available, then increment it in corresponding document count... if not available i.e, New word then create a new column then increment the document count and put Zero ...

Datastructures, C#: ~O(1) lookup with range keys?

I have a dataset. This dataset will serve a lookup table. Given a number, I should be able to lookup a corresponding value for that number. The dataset (let's say its CSV) has a few caveats though. Instead of: 1,ABC 2,XYZ 3,LMN The numbers are ranges (- being "through", not minus): 1-3,ABC // 1, 2, and 3 = ABC 4-8,XYZ // 4, ...

Data Structure to represent a DFA

Hi All, I was wondering, what would be the best data structure to represent a DFA ? I am looking at converting a regular expression to a DFA and make this particular functionality as a library in java. The main thing is that, each entity in the regex carries a set of value rather than a single string value like "car" . In my case , ...

What is the smartest data structure to use when doing several lookups and insertions, but no deletes?

I will never be deleting from this data structure, but will be doing a huge number of lookups and insertions (~a trillion lookups and insertions). What is the best data structure for handling this? Red-black and AVL trees seem decent, but are there any better suited for this situation? ...

The book about writing search engine. Recommend some...

I want to learn more about the full-text search. Recommend please a few good books in which would be well described used algorithms and data structures, which must describe how to write simple search engine. I use C++. Thanks! ...

Which Delphi data structure can hold a list of unique integers?

When I approach Java problems, I use the collection pattern. However, doing it in Delphi is quite a nightmare since there is no Integer object to handle things. I need a data structure that holds numbers. I want to be able to add numbers, remove numbers, and check the contents of the collection, and each number must be unique. I'm not...

Warning-free Templating in C

Transitioning from C++, I am now learning the dark art of C and have developed the following code to replace my need for templating. In the bottom example, I have implemented your garden-variety Node structure in such a way that it can be used to store any data type. Consider the following... // vptr.c #include <stdio.h> struct Node {...

Is there a Binary Search Tree implementation in .NET 4?

I'm looking for a built-in Binary Search Tree implementation in .NET 4. Is there one? ...

Need efficient data mappings example for a ListView drill down in Android/Java

I'm pretty new to java programming and am looking to do basic data mappings. I have a ListView object with a simple data array setup like this: setListAdapter(new ArrayAdapter<String>(this, R.layout.my_list_xml, MY_DATA)); What I want to happen is when you click an item it goes to it's subcategory. I'm not worried about switching th...

invitation chains

The site what.cd uses a type of invitation chain whereby if I invite a friend to the service and they break the rules and loose their account I also loose my account as does the person who invited me and so on. What is the best way to keep track of this kind of invitation inheritance, Just a table cell linking the user to the user who ...

Inserting node in a double-linked list

I'm having trouble understanding the second half of connecting a new node into a double-linked list. I'm writing an add method that takes in the node which the new node is to be inserted after. My area of difficulty is understanding how to link to the next node after the previous node links have been re-directed to the new node. So, h...

Data Structure behind LDAP Database

What kind of Computer Data Structure is being used internally in a LDAP Database? Is it Binary Tree, B+ tree or Trei or something else? ...

Asynchronous buffer loading

Intro: I have a bottleneck in my C# application where I need to load a page as a bitmap from a PDF or Tiff file and process this bitmap while in memory. Tiff files load fairly fast, as well as first-party PDFs (we can read our own). The bottleneck comes in when the PDF file is third-party and we need to parse the PDF page and turn it in...

Searching for hints on how to implement immutable data structures in C++

Hi everybody, I'm wondering how to implement immutable data structures in C++ (or C). I'm searching for a book or paper (or a relatively simple and documented implementation) on the subject and I haven't managed to find one for now so I decided to ask for hints. Thanks in advance for your answers. ...

how to implement n:m relation in java?

Sorry for this newbie question, but I just never worked with java... My problem is I need to implement an n:m relation in java. The use case is a catalog. a product can be in multiple categories a category can hold multiple products the classic... My current solution is to have a mapping class that has to hashmaps. The key of the ...

Post order traversal of a formula

In data structures, I get converting in order and pre-order formula conversions into trees. However, I'm not so good with post-order. For the given formula x y z + a b - c * / - I came up with - / \ * / (divide) / \ / \ x + - c ...

Managing a priority queue?

I have a structure struct state{ int cur[10]; int next[10]; int priority; }; and a priority queue of these states.How can I manage the priority queue so that front element is the element with the minimum value of 'priority' ? ...

How to store millions of Double during a calculation?

Hello, My engine is executing 1,000,000 of simulations on X deals. During each simulation, for each deal, a specific condition may be verified. In this case, I store the value (which is a double) into an array. Each deal will have its own list of values (i.e. these values are indenpendant from one deal to another deal). At the end of a...