data-structures

java: resetting ListIterator?

I need to traverse a LinkedList a number of times, in a way that suggests using ListIterator. Is there a way to reset a ListIterator? or is it better to just create a new one? (and what if I can't because I don't have access to the list?) edit: and is there a way to create a ListIterator that points to the end of the list? (so that has...

Which topic in Discrete Mathematics is considered as a prerequisite for data structures course?

Hello, I want to read a book on Data Structures and Algorithms, but i would like to know if there is any specific topic in Discrete Mathematics considered very important as a prerequisite in order to understand the materials presented in Data Structure Book. Thank you in advance for your help P.S i am self-thought programmer, i didn't...

Sparse voxel representation of point cloud data

Is there a c/c++ implementation of sparse voxel representation for any 3D point cloud dataset? ...

Data Structures to store complex option relationships in a GUI

I'm not generally a GUI programmer but as luck has it, I'm stuck building a GUI for a project. The language is java although my question is general. My question is this: I have a GUI with many enabled/disabled options, check boxes. The relationship between what options are currently selected and what option are allowed to be select...

What Data Structure could I use to find the Phone number of a person given the person's name?

What Data Structure could I use to find the Phone number of a person given the person's name? ...

recieving only the structure of the table using SQL and PHP and put into an Array

Is it possible to recieve only the structure of the table even if its emtpy and put the field names in an array. if so wich sql command makes that possible. thanks Matthy ...

Declarative access to structured PHP variable without foreach loops

Background Assume I have the following nested variable in PHP. $data = Array( Array('lname' => 'Simpson','fname' => 'Homer','age' => '35','motto' => '_blank_'), Array('lname' => 'Simpson','fname' => 'Marge','age' => '34','motto' => '_blank_'), Array('lname' => 'Flintstone','fname' => 'Fred','age' => '33','mo...

How to sort a stack using only Push, Pop, Top, IsEmpty, IsFull?

Given a stack S, need to sort the stack using only Push, Pop, Top, IsEmpty, IsFull. Looking for most simple solution. Edited: Removed in place condition. Can't use another stack or queue. ...

What is a vocabulary tree and how to build one?

I'm reading a lot about vocabulary trees when it comes to fast queries for similar images or texts in big databases. But I couldn't find any good (easy to unserstand) description on what such an vocabulary tree is and how to build one out of features. ...

In C, copying of array like this is not possible. Why? and best hack

int x[10],y[10]; x = y; I am thinking of a simple hack, which would enable me to get this effect. ...

An efficient way that deletes specified characters from a string

For example, given a str of "Stackoverflow is for every one" and remove of "aeiou", the function should transform str to "Stckvrflw s fr vry n". I have one char array of string: str[] and one char array of chars to be removed:remove[] My Solution: Loop str[] looking for each in character in remove[]. Shift str[] one place left every-t...

Intersection of two linked lists

Given two sorted linked lists, L1 and L2, a solution to compute their intersection L1 intersection L2. ...

Self-indexing (and traditional indexing) algorithms - Implementations and advice to share?

As part of a research project I'm currently looking for open-source implementations of self-indexing algorithms, i.e. a compressed form of the traditional inverted index yielding nice characteristics such as faster lookup and/or less consumed space. Do you know of any open-source implementations of self-indexing algorithms? Do you have ...

simple java question

Hi All, I moved from Php to java. I am not much familiar with java power. I have couple of questions. 1 - I am reading a directory and that directory has more than 500 files. I am storing file names and contents in hashmap. Please tell me is it good for speed (performance)? If no which other data structure I can use? 2 - I am using ab...

effective C++ data structure to consider in this case

Greetings code-gurus! I am writing an algorithm that connects, for instance node_A of Region_A with node_D of Region_D. (node_A and node_D are just integers). There could be 100k+ such nodes. Assume that the line segment between A and D passes through a number of other regions, B, C, Z . There will be a maximum of 20 regions in betw...

C# dictionary, need advice

Hi, I want to write some sort of dictionary that would accept current time and return what user-define time period it is. As time-preiod I mean user-defined names for time period that are read from file. For example 8:00-9:00 - breakfast time 9:00-12:00 - work time 12:00-13:00 - lunch time etc... Currently I have a function is base ...

How to print structures in PLT Scheme so as to display their fields?

I would like code like this: (define-struct thing (a b c)) (define th (make-thing 1 2 3)) to print something like this: (make-thing 1 2 3) when I type "th" into either the DrScheme or MzScheme repl. I am using the language "pretty big" in DrScheme with output style set to "constructor". This is what I get in DrScheme: (make-thin...

If statement in c++

Hay Dear! i know that if statement is an expensive statement in c++. I remember that once my teacher said that if statement is an expensive statement in the sense of computer time. Now we can do every thing by using if statement in c++ so this is very powerful statement in programming perspective but its expensive in computer time pers...

MySQL "ON DELETE CASCADE" is too powerful

hey, following problem here: i have table with persons that have one location, if i delete the location for the location table, i don't wont to lose the assigned persons. ive a entry in the location with the id=1 and the name is: "No location". and that what I'm trying to do, but i fail! ALTER TABLE `persons` ADD CONSTRAINT `persons_i...

Construct a Tree

How can I construct a tree given its inorder and preorder traversal? I am just looking for an efficient algorithm. ...