data-structures

Why doesn't java.util.Set have get(int index)?

I'm sure there's a good reason, but could someone please explain why the java.util.Set interface lacks get(int Index), or any similar get() method? It seems that sets are great for putting things into, but I can't find an elegant way of retrieving a single item from it. If I know I want the first item, I can use set.iterator().next(), ...

PDF Data source in Informatica

How does Informatica handle unstructured data sources like PDF. If a tabular report is stored as a PDF, can we read it out from PDF as a tabular data (like a data table in .net)? ...

Ugly looking java data structure

I've created the following structure which maps unique double values to one or more pairs of integers: @SuppressWarnings("boxing") private static final HashMap<Double, Integer[][]> rules = new HashMap<Double, Integer[][]>() { private static final long serialVersionUID = 1L; { put(-0.6, new Integ...

Book on c# algorithms and data structures

Could you recommend a good book on C# algorithms and data structures? I am looking for something that is intermediary to advanced as a difficulty level. Java would also be acceptable, but I would prefer a book on C#. ...

What does it mean to instantiate an object using curly braces in C++?

Let's say I have a struct defined as: typedef struct number{ int areaCode; int prefix; int suffix; } PhoneNumber; When I create an instance of this struct, if I use the following syntax: PhoneNumber homePhone = {858, 555, 1234}; ...which constructor is it calling? The default constructor, or the copy constructor, or non...

When inserting to a BST, is the first item inserted always the root of the tree?

Looking at the implementation on Wikipedia, it would seem that a standard BST (non self balancing) never re-arranges itself during inserts, and so the very first item added will always be the root. Is this correct? If so, doesn't that mean that there is the potential for a BST to often have much worse than O(logN)? Using this as a refer...

PHP/MySQL: The right way creating a big website database based...

Hi, I'm creating a movies website, IMDB.com like.. I'm really new to PHP and programming at all but I have some books and StackOverflow of course :) I have already done lot of the work, but now I have more than 600 lines of code (PHO only) per page and more than 20 database tables only for storing and geting the movie data (many-to-many...

C++ drawing a Tree..

Hi . I googled for a Tree Visualization Framework or something like that in C++ . And i wondered that i didn't find anything like that. Are There any (good) Framework to draw a Tree (or other Data Structures) ? It should be in C++. ...

Is a kd-tree suitable for 4D space-time data (x,y,z,time)?

I want to use a data structure for sorting space-time data (x,y,z,time). Currently a processing algorithm searches a set of 4D (x,y,z,time) points, given a spherical (3d) spacial radius and a linear (1d) time radius, marking for each point, which other points are within those radii. The reason is that after processing, I can ask any 4D ...

What's wrong with my KD-Tree? (K=2)

More specifically, there's something wrong with my nearest neighbor search. I've confirmed that the tree is built correctly, and that all the helper functions work as expected. Note this differs slightly from standard KD-trees in that I'm looking for the closest 3 points. struct Node { unsigned int axis; Point* obj; struct Node* left...

A Data Structure to represent bookable timeslots

What suggestions do people have for a timeslot data structure? I have a number of activities and I'm planning to display them in a datagrid with days as columns and timeslots as rows. This suggests to me a timeslot data structure with 5 properties for the five days (the columns) for every value I want to use e.g. a timeslot ID and the n...

Is there anything like a generic list in Cocoa / Objective-C?

What I really like in C# are generic lists. A list that can contain only one type of objects. Is there something like a generic list in Cocoa/Objective-C? As far I only know NSArray who will take a pointer to any object. ...

Java HashMap indexed on 2 keys

I want to create a HashMap in java for users with preferences. This would be easy to do in a database, but unfortunately I can't use a database. What I need is a way to find a user by name in the HashMap, and to find all the users with a certain interest (e.g. golf). If I delete a user, then all their interests should be deleted. Anyon...

What is a quad linked list?

I'm currently working on implementing a list-type structure at work, and I need it to be crazy effective. In my search for effective data structures I stumbled across a patent for a quad liked list, and this sparked my interest enough to make me forget about my current task and start investigating the quad list instead. Unfortunately, in...

Building a high performance and automatically backupped queue

Please give me some hints on my issue. I'm building a queue data structure that: has a backup on hard disk at realtime and can restore the backup Can respond to massive enqueue/dequeue request Thank you! ...

mapping data in properties files

I have the following data: User System SubSystem user1 System1 SubSystem1 user2 System1 SubSystem2 user3 N/A N/A and i need to be able to determine the system/subsystem tuple from the user. I must be able to add users at any time without rebuilding and redeploying the system I know the database would be the best option ...

Reading cobol datastructures from Java

Is there a way to read cobol data in a Java program? More concretely I'm confronted with the following case: I have a file with fixed length records of data. The data definition is done as Cobol copybooks. What I think of is a library which taking into account the copybooks would be able to read those records. Ideally it should be pos...

Where is the Queue class in the Java Collections?

I only see a Queue interface, is there no Queue class in the Java Collections? ...

Is there a data structure that doesn't allow duplicates and also maintains order of entry?

Duplicate: http://stackoverflow.com/questions/769097/choosing-a-stl-container I'm looking for a data structure that acts like a set in that it doesn't allow duplicates to be inserted, but also knows the order in which the items were inserted. It would basically be a combination of a set and list/vector. I would just use a list/vector a...

What data structure will hold a bounded stack of items in LIFO ?

I'm looking for a data structure that is basically a bounded stack. If I declare that the stack can hold at most 3 items, and I push another item in, the oldest item is popped. ...