data-structures

What data structure should I use for a snake game?

I have some homework for my school and I have to make a snake game, like Nokia's, in Delphi. I wonder which solution is the best. I want my snake be a class and the body is an array of points (parent class) or a linked list of points. What's the best? An array or a linked list? ...

conversion from infix to prefix

HAi I am preparing for an exam where i couldn't understand the convertion of infix notation to polish notation. for the below expression (a–b)/c*(d + e – f / g) Can any one tell step by step how the given expression will be converted to prefix. thank you ...

Arrange the numbers such that numbers in a block are unique

Given a string of numbers say "5556778", and a num N(say 2), rearrange the string such that numbers in any continuous block of size N are unique. e.g: for the above string and N=2, one rearrangement can be 5657578. For N=3: 5765785 find the arrangement in linear time. ...

Passing complex data over URL with grace

I'm thinking about using something like: <script src="http://www.example.com/?key={"param":"value"}"&gt; As you can see in the example above a JSON formatted string is being passed over the src URL. The example, of course, doesn't work because both the JSON string and the script tag use double quotes. Here are a few solutions that I ...

Advantages of BTree+ over BTree

Possible Duplicate: B- trees, B+ trees difference What are the advantages/disadvantages of BTree+ over BTree? When should I prefer one over other? I'm also interested in knowing any real world examples where one has been preferred over other. ...

Whats is the meaning of dynamic linked data structure? Please give some example

Hi, I wanted to know meaning of dynamic linked data structure? Please give some example.Which data structures can be classified as static linked data structures and which can be classified as dynamic linked data structures ? Thanks. ...

Example uses of Judy Trees

I was reading about Judy Trees and would like to see examples of real world usage and comparisons to other data structures. ...

Use of XML for Model class and structuring

Hi there, I am currently working on a little application: The structure follows in some way the MVC pattern. For short it has the basic things, Models, Controllers etc. Now I am sitting here and do not know whether : 1. The SQL database is only managed by a model through methods the programmer gives him like: "Hey we have name reco...

Good algorithm and data structure for looking up words with missing letters?

Hi, so I need to write an efficient algorithm for looking up words with missing letters in a dictionary and I want the set of possible words. For example, if I have th??e, I might get back these, those, theme, there.etc. I was wondering if anyone can suggest some data structures or algorithm I should use. Thanks! EDIT: A Trie is too ...

Modification of shortest path algorithm (route from a node to itself)

I am applying the all-pairs shortest path algorithm (Floyd-Warshall) to this directed graph: The graph is represented by its adjacency matrix. The simple code looks like this: public class ShortestPath { public static void main(String[] args) { int x = Integer.MAX_VALUE; int [][] adj= { {0, 6, x, 6, 7}, ...

Which data structure should I use for storing hash values?

I have a hash table that I want to store to disk. The list looks like this: <16-byte key > <1-byte result> a7b4903def8764941bac7485d97e4f76 04 b859de04f2f2ff76496879bda875aecf 03 etc... There are 1-5 million entries. Currently I'm just storing them in one file, 17-bytes per entry times the number of entries. That ...

Big-O and Cache Aware Data Structures & Algorithms

Is there someplace where I can get a Big-O style analysis / comparison of traditional data structures such as linked lists, various trees, hashes, etc vs. cache aware data structures such as Judy trees and others? ...

Access to enclosing/parent NSDictionary of an object.

Is there any method I can send to an object, which will return an enclosing collection (NSDictionary/NSArray)? Or a method which would return a collection of all the objects with a retain call on the object in question? DJS. @bburn: It possibly is a design problem. I'm trying to parse an XML document, and more or less convert the entir...

Two sided (bidirectional) list in Java

Is there something like a two sided list in Java? Maybe a third party implementation? Here a little example to demonstrate what I have in mind. Original state: A: 0-1-2-3 | | | | B: 0-1-2-3 After removal of element 1 in B: Null | A: 0-1-2-3 | / / B: 0-1-2 The data structure must be accessible from both sides. So...

How does 3D collision / object detection work?

I'v always wondered this. In a game like GTA where there are 10s of thousands of objects, how does the game know as soon as you're on a health pack? There can't possibly be an event listener for each object? Iterating isn't good either? I'm just wondering how it's actually done. ...

Delete a node in singly link list

How to delete a node in a singly link list with only one pointer pointing to node to be deleted? [Start and end pointers are not known, the available information is pointer to node which should be deleted] ...

Print List Items. - Need Help.

Hello Merry Xmas List<string> list = new List<string>(); list.Add("A"); list.Add("B"); List<string> list1 = new List<string>(); list.Add("a"); list.Add("b"); for (int i = 0; i < list.Count; i++) { // print another list items. for (int j = 0; j < list1.Count; j++) ...

C generic programming

First of all, I am a beginner programmer (still much to learn). In one of my small school projects I have written a stack for a struct . Now I have a slightly different struct and I need a stack for this one too. Should I write another data structure [stack] (very similar to the initial one), or try to achieve some generic programming.....

Offline tool to work with MySQL databases like phpMyAdmin?

Like phpMyAdmin has to be installed as a web application to work with MySQL databases, is there a downloadable program that can connect to a remote MySQL server to create, read, update and delete databases, tables, columns and rows? ...

What are algorithms and data structures in layman’s terms?

I currently work with PHP and Ruby on Rails as a web developer. My question is why would I need to know algorithms and data structures? Do I need to learn C, C++ or Java first? What are the practical benefits of knowing algorithms and data structures? What are algorithms and data structures in layman’s terms? (As you can tell unfortunat...