data-structures

Storing Large 2D Game Worlds

I've been experimenting with different ideas of how to store a 2D game world. I'm interested in hearing techniques of storing large quantities of objects while managing the set that's visible ( lets say 100,000 tiles square ). Obviously the techniques can vary based on how the game renders that space. Lets assume that we're describing ...

Parent And Children Relationship

Hello Guys, I am haveing this problem with my application and need help. I have data from the server in this form Food Apple Fruit Seed etc.. Table Chair pen School et.. ... Food Mango Peer Melon etc.. Reading from the left, i want to make for eg; in the first row, Food parent of Apple Apple parent of Fruit Fruit...

One table per every similar object?

I write an application for drawing shops. I have these classes in my system: shop, cart place, rack and bakery. They have this properties: shop: X, Y, name, width, height, type, address cart place: X, Y, name, width, length, type, capacity rack: X, Y, name, width, length, type, height, balance_limit bakery: X, Y, name, width, leng...

What are some common uses for bitarrays?

I've done an example using bitarrays from a newbie manual. I want to know what they can be used for and what some common data structures for them (assuming that "array" is fairly loose terminology.) Thanks. ...

Bi-directional dictionary?

I have two sets of objects where in some cases the first set will be used as keys for the other set, and in other cases the second set will be used as keys for the first. In addition there must be no duplicates in either list. What would be a good data-structure to use for this? Should I use two Dictionaries for this or are there smarte...

Transferring Data Between Server and Client (Mobile)

Scenario: Client (Mobile) - .Net CF 2.0, SQL CE 3.0 Server - .Net 2.0, SQL Server 2005, Web Service Client and Server database schemas differ. From server - only certain columns from certain tables need to be synced. From client - everything will need to be synced once client has made changes. Client will continually poll a web ser...

Criteria for selecting the right STL container for the job?

Do you just base your STL container selections on the following attributes? Searching/Updating Insertion and Deletion If not, what else do you base your selections upon? Is there any reference out there that lists how each container performs across all these different attributes? ...

Why does TEnumerable<T> use pass-through methods?

TEnumerable<T>, the base class for all the Generics.Collections container classes, has a very strange declaration. It looks like this: type TEnumerable<T> = class abstract protected function DoGetEnumerator: TEnumerator<T>; virtual; abstract; public function GetEnumerator: TEnumerator<T>; end; function TEnumerable<T>.G...

Comparing Linked-objects

I have some data from server which looks like this. Each row is an array so the data comes as an array of arrays: net Person age net Person height net Address streetname org Company name org Company location com School color com School number From left to r...

Efficient look-up in a List

Hi, I have a situation whereby I'm populating an ArrayList with "TransactionEvent"s. TransactionEvent has a property "transaction ID". In the large majority of cases each new event has a transaction ID greater the previous event's ID - However, this is not guaranteed; i.e. the data is almost sorted. My question is this: How can I per...

Which C# data structure to use for my problem

I was just wondering what do you guys think would be the best c# data structure for problem like this. So I will have an array of keys, and for each key array of arrays. Sounds complicated does it :) Anyway the simplest solution that comes to my mind, note that I never did any formal c# training. It was more I am C++ programmer and the...

What's a simple reference or cheat sheet for nested data structures in Perl?

What's a simple reference or cheat sheet for nested data structures in Perl? ...

Most efficient way to reverse a stack and add to an ArrayList

So, this is an efficiency question. I have two collections - an ArrayList and a Stack. I use the stack because I needed some simple pop/push functionality for this bit of code. The ArrayList is essentially the out variable as this is a small section of code in the function. So, I the variables are defined as such, then code is run to ...

Efficient Tree Sort

I'm not really happy with my methods to build a tree structure in my J2ME Application. Can anybody point in a more performant direction? If you need some more code to understand my snippets, just comment below. Java Version is 1.4. Many thanks, rAyt if(companyList != null) { companyList.setNodeStructure(null); Hashtable nodes...

project ideas on algorithms ,data structures and parallel programming

Hi, I am a final year Computer Science and Engineering student.As part of the final year project i was planning to implement a graph algorithms library(using parallelization) for c++ but came to know that they have already been implemented. I would be very grateful if you people could suggest me some other project ideas related to my...

When should I use the HashSet<T> type?

I am exploring the HashSet<T> type, but I don't understand where it stands in collections. Can one use it to replace a List<T>? I imagine the performance of a HashSet<T> to be better, but I couldn't see individual access to its elements. Is it only for enumeration? ...

Best way of designing the flow of code when reading/writing from database

So I'm trying out a concept tool of mine where I need to be able to read and write data from a database real easy. I've set up the form as I like and spread around different text boxes and dropdownboxes to read the data from the database. And I've got it all to work and all, but there's a small bug I don't fully understand why's there. S...

Transform map with multiple values to tree?

Given a randomly distributed set of keys, with each key mapped to a set of values, how would you transform it into multiple trees? Example Data Set NB2 => {NC2 ND2} ND1 => {NG1 NH1} NA1 => {NB1} NB1 => {NC1 ND1 NE1} NA2 => {NB2} NC1 => {NF1} NE1 => {NI1 NJ1 NK1} Resulting Tree for NA1 NA1 `-- NB1 |-- NC1 | `-- NF1 |-...

Efficient container for bits

I have a bit array that can be very dense in some parts and very sparse in others. The array can get as large as 2**32 bits. I am turning it into a bunch of tuples containing offset and length to make it more efficient to deal with in memory. However, this sometimes is less efficient with things like 10101010100011. Any ideas on a good w...

compact data structure like set

i am looking for a specific data structure, but i forgot its name. if i knew the name it would be trivial, i would just look it up in wikipedia :) basically, it is like a set - except you cannot iterate it. you put some values in it, lets say 80k zip codes. then you can test if a given string is definately NOT a zip code, but you will...