data-structures

Map of Maps data structure

Hi, The MultiValueMap class (Apache commons collections) makes it easy to work with a Map whose values are Collections. I'm looking for a a class that makes it easy to work with a Map whose keys are objects and values are Maps. I'm using Java 1.4, so can't use Google Collections or generics. Thanks, Don ...

GUI tools and APIs for small/medium hierarchical data structures

Hi, I'm trying to find a tool and library to edit, write and read data in a hierarchical structure, similar to an LDAP tree, a Windows registry or a Berkeley DB structure. The keys should represent some hierarchy, and the values should have a relatively flexible format (typing is optional, but could be useful). Here is an example: Item...

find most often seen string from a log file

hello guys, I want to find most often seen string in a huge log file. Can someone help me how to do this. one way to do this is to hash each and every string and count the maximum value but its not efficient. Are there any better ways to do this. Thanks & Regards, Mousey. ...

What is a data warehouse?

I was asked by a customer what the term "data warehouse" really means. I thought about ETL, details of the data model, differences to NoSQL, Clouds, 'normal' DBMS, MDM (Master Data Management) etc. but wasn't able to describe the term in a few words to him... (In fact I did some talking and left him unillumined.) How can "data warehou...

How to efficiently store a matrix with highly-redundant values

I have a very large matrix (100M rows by 100M columns) that has a lots of duplicate values right next to each other. For example: 8 8 8 8 8 8 8 8 8 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 4 8 8 1 1 1 1 1 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 3 3 3 3 3 3 3 3 3 3 3...

Programming Videos (C/C++/Datastructures)???

Please let me know if you encounter any good programming (C/C++/Datastructures) video tutorials. This is something I found which has quite a good compilation http://freescienceonline.blogspot.com/2007/09/programming-language-video-lectures.html ~ Sam (The more I give the more I receive) ...

Code vs. configuration for game object library

I'm working on a small online game where there is a need to store a reasonable amount of information about many (100+) different kinds of game objects. I'm trying to decide whether to have this data generated by code or stored in some configuration file. Data generation approach would be something like (in java-ish pseudo code): (wit...

Persistent data structures in Scala

Are all immutable data structures in Scala persistent? If not, which of them are and which not? What are the behavioural characteristics of those which are persistent? Also, how do they compare to the persistent data structures in Clojure? ...

Data structure and algorithms for a directed cyclic graph (F#)

I'm trying to analyse an application where the assembly references should be a directed-acyclic-graph, but aren't. There is also a related problem of sub-assemblies referencing different versions of one sub-sub-assembly (think Escher...) What I want to do is analyse each assembly-subassembly pair and build up a picture of where things a...

Python: problem processing a string

I have a string as follows: names = "name:fred, name:wilma, name:barney, name2:gauss, name2:riemann" let's say the string names has name and name2 attributes. How do I write a function, is_name_attribute(), that checks if a value is a name attribute? That is is_name_attribute('fred') should return True, whereas is_name_attribute('gau...

Abstracting away from data structure implementation details in Clojure

I am developing a complex data structure in Clojure with multiple sub-structures. I know that I will want to extend this structure over time, and may at times want to change the internal structure without breaking different users of the data structure (for example I may want to change a vector into a hashmap, add some kind of indexing ...

How to return the best first level in this F# minimax?

Hello folks, This question is more a semantic-algorithmic-data-structure question than a F# syntactically question. I have a Minimax algorithm. The minimax algorithm should return the best next move, from a start position. To do this, it calculus all next moves, then the next-next-moves until a determined depth or until there is no more...

max heap and binary tree

Hi this is an example in my data structure book and for this exercise was written that this is not a max heap,but it doesn't say its reason would you please help me that why it is not a max heap thanks. 35 / \ / \ 27 28 / \ / \ / \ / \ 14 16 20 19 ...

Adding a stdClass Object in a data strcture (in php)

stdClass::__set_state(array( 'zone1' => array ( 0 => stdClass::__set_state(array( 'id' => '123', 'owner' => '234', ... )), Hi, My basics are a bit shot, so I'm having trouble with this... I need to create the above structure, but I'm not sure how to... ...

Indexing count of buckets

So, here is my little problem. Let's say I have a list of buckets a0 ... an which respectively contain L <= c0 ... cn < H items. I can decide of the L and H limits. I could even update them dynamically, though I don't think it would help much. The order of the buckets matter. I can't go and swap them around. Now, I'd like to index the...

How can I reverse-map (hash) `pthread_t`s to structure pointers?

I have a thread datatype in the interpreter implementation for a programming language I am working on. For various reasons, it’s a fairly common operation, to need to get the current thread (which is, itself, a pointer: a struct thread*). However, pthread_self(3) hands me a pthread_t, which is an opaque type; on some systems, it seems t...

handling large scale dataset

From the online discussion groups and blogs, I have seen a lot of interview questions are related to handling large scale dataset. I am wondering is there a systematic approach to analyze this type of questions? Or in more specific, is there any data structure or algorithms that can be used to deal with this? Any suggestions are really a...

How are arrays implemented in Perl?

The Perl array is an abstract data type. What's the internal mechanism for the Perl array? Is it implemented with dynamic array or linked list? Since the array elements have random access, I would assume a dynamic array of pointers, or references to scalars make sense. However, with shift and unshift operation at the head of array, woul...

What thing hash_map stores as keys?

Hi all, I have an infinite streams of numbers coming and I have to detect the first duplicate element. I think of using hash table for the above problem i.e whenever a number arrives, check whether it is already there in the hash table or not. In case it has, stop otherwise add that number to hash table. Now my question is does hash tab...

What is a tree graft point?

Hello, I've heard some terminology in regards to trees that I haven't heard before. There are some references to graft points in our code base in relation to n-ary trees. What exactly is a graft point in a tree and what could these references be referring to? Thanks! ...