data-structures

Merging two perfect binary heaps?

I've been stuck on a question for a while and was wondering if anyone can point me in the right direction: suppose binary heaps are represented using a pointer-based tree representation instead of an array. consider the problem of merging binary heap LHS with RHS. assume both heaps are full complete trees, containing (2^L) - 1 and (2^R)...

Data structure/Algorithm for Streaming Data and identifying topics

Hi, I want to know the effective algorithms/data structures to identify the below information in streaming data. Consider a real-time streaming data like twitter. I am mainly interested in the below queries rather than storing the actual data. I need my queries to run on actual data but not any of the duplicates. As I am not i...

data structure to support google/bing maps

I was wondering what the data structure is in an application like google/bing maps. How is it that the results are returned so quickly when searching for directions? what kind of algorithms are being used to determine this information? thanks ...

Cache-oblivious data structures and dynamic languages - effective?

I've been reading recently about cache-oblivious data structures like auxiliary buffer heaps. These data structures work by keeping their most-recently-accessed elements in cache memory so any subsequent access is also quicker. Most of these data structures are implemented with a low-level language like C/C++. Is it worth it to try to p...

MQ EOL Data conversion

we are sending data trough MQ from a z/OS/CICS system to an AS400. Original encoding of the message is CCSID 500 with a MQSTR Format. The client application is getting the message with the CONVERT option and CCSID 819. Data is almost converted correctly except for the end of line caracter. Any idea? The z/OS is sending 0D (CR) as end o...

Where can I find review materials?

I've got interviews coming up for an internship this summer, and I'd like to review common algorithms and data structures so that I won't be caught off guard by any of the technical questions. Can anyone recommend a good resource, online or otherwise, for a refresher on common things like shuffling an array, tree traversal, linked list...

Help designing my own rough DataContext

Hi All I've done a bit of Linq programming with TDD ASP.Net MVC and loved it. Digressing, I'm now learning webforms against stored procs and cannot use linq. I would like to retain some of the loose coupling and testability enjoyed with MVC. I didn't have the time to learn and setup a dependency injection infrastructure so instead ...

Lua's hybrid array and hash table; does it exist anywhere else?

Lua's implementation of tables keep its elements in two parts: an array part and a hash part. Does such a thing exist in any other languages? Take a look at section 4, Tables, in The Implementation of Lua 5.0. Lua 5.1 Source Code - table.c ...

Efficient search in a corpus

I am having a few million words which I want to search in a billion words corpus. What will be the efficient way to do this. I am thinking of a trie, but is there an open source implementation of trie available? Thank you -- Updated -- Let me add few more details about what exactly is required. We have a system where we crawled news...

Data structure, best practice to build true "related by tags" items list?

What I mean saying true "related by tags" list? Let's imagine that article have 3 tags: A, B, C. True "related by tags" articles for this item will be articles fistly having A, B, C tags, then (A, B), (A, C), (B, C) etc. table: tags tag_id tag_title tag_nicetitle table: tags2articles article_id tag_id Using this tables structure ...

Recursive and non recursive procedures for trees

Dear Sir! as we know that the trees are recursive data structures, We use recurrsion in writing the procedures of tree like delete method of BST etc. the advantage of recurrsion is, our procedures becomes very small (for example the code of inorder traversal is of only 4 or 5 lines) rather than a non recurrsive procedure which would be...

Relational databse, photos, votes and warnings

Hi, I'm designing a relational database, but I'm not too much experienced, so I'd like to ask a suggestion about the relational tables with photos. I thought to use a table to store photos, and one or more tables for user data and subject links, so the photos can be linked to different subjects, for example to houses, or trees, in this ...

What's a good data structure for a multiple-value primary key object?

This question can best be asked by example. Say I have a database table called "Car" with the following columns: (Make*, Model*, NumberOfDoors*, Description, Price, Mileage, Color) The 3-tuple of Make, Model, and NumberOfDoors makes up the unique primary key in the database. What I've done is made a "Car" class for each line item, bu...

Random-access container that does not fit in memory?

I have an array of objects (say, images), which is too large to fit into memory (e.g. 40GB). But my code needs to be able to randomly access these objects at runtime. What is the best way to do this? From my code's point of view, it shouldn't matter, of course, if some of the data is on disk or temporarily stored in memory; it should ...

Data structure for mapping URLs or local paths

Hi, I've been trying to workout a good way of doing this fast but I'm not sure what will be the most optimal, I'm hoping some of you more experienced developers can assist via your Data Structures knowledge :-) Essentially I have a list of paths (Eg. C:\inetpub\wwwroot\, C:\www\websites\vhosts\somesite.com\, D:\www-mirror\websites\vhos...

Java object Equality

The two cards c1 and c4 seem to be equal...but they are not why. I want them to be equal so that only one of them is allowed in the Set. :| import java.util.*; class Card2 { private int value; private String type; public Card2(int v,String t) { value=v; type=t; } public int getValue() { return value; } public String ge...

4 program design interview questions

I was preparing for technical interviews and would like to know how could I go about briefly explaining an interviewer about the approach to designing the following programs without going into unnecessary details 1. Program that lets people play tic tac toe with each other over the internet? 2. A suitable data structure f...

TreeMap: get values in sorted order

i have the following TreeMap: TreeMap<Integer, Double> map; the Double values are not unique. i iterate through the map using Integer keys and the functions firstEntry() and higherEntry() and modify the Double values. Now i want to list the values of the pairs in the order of decreasing Double values. what is the best way to do this...

OpenCV / SURF How to generate a image hash / fingerprint / signature out of the descriptors?

There are some topics here that are very helpful on how to find similar pictures. What I want to do is to get a fingerprint of a picture and find the same picture on different photos taken by a digital camera. The SURF algorithm seams to be the best way to be independent on scaling, angle and other distortions. I'm using OpenCV with th...

Nested struct viewer for Linux Kernel

I am in the process of tackling the Linux Kernel learning curve and trying to get my head round the information stored in nested struct specifically to resolve a ALSA driver issue. Hence, I am spending a lot of my time in the source code tracing through structures that have pointers to other structures that in turn have pointers to yet ...