Showing posts with label data-structures. Show all posts
Showing posts with label data-structures. Show all posts

Tuesday, May 29, 2012

Graph visualization code in javascript?


Hi. I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. Does anyone know of any javascript code that can do a reasonable job with graph layout? These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so that users can tweak the layout manually by dragging the nodes around.

Sunday, May 20, 2012

Why Dictionary is preferred over hashtable in C#?


In most of programming languages, we preferred using a dictionary over a hashtable . What are the reasons behind it?

Thursday, May 10, 2012

Dojo require() and AMD (1.7)


I'm having a heckuva time transitioning to Dojo and the new AMD structure, and I'm really hoping someone can shed some light on the whole concept. I've been living on Google for the last few weeks trying to find information on not the usage, but the structure and design pattern trends in using this.

Monday, May 7, 2012

Need memory efficient way to store tons of strings (was: HAT-Trie implementation in java)


I am working with a large set (5-20 million) of String keys (average length 10 chars) which I need to store in an in memory data structure that supports the following operation in constant time or near constant time:

Sunday, April 8, 2012

javascript data structures library



I'd like to ask for recommendation of JavaScript library/libraries that supply an implementation of some basic data structures such as a priority queue, map with arbitrary keys, tries, graphs, etc. along with some algorithms that operate on them.





I'm mostly interested in:





  • The set of features covered,



  • Flexibility of the solution - this mostly applies to graphs. For example do I have to use a supplied graph implementation,



  • Use of functional features of the language - again it sometimes gives greater flexibility,



  • Performance of the implementation







EDIT





Ok, I'd like to point out that I'm aware that it's possible to implement using js the following data structures:





  • A map, if key values are either strings or numbers,



  • A set, (using a map implementation),



  • A queue, although as was pointed out below, it's inefficient on some browsers,







At the moment I'm mostly interested in priority queues (not to confuse with regular queues), graph implementations that aren't very intrusive as to the format of the input graph. For example they could use callbacks to traverse the structure of the graph rather than access some concrete properties with fixed names.



Source: Tips4all

Tuesday, February 14, 2012

Java: Best way to store to an arbitrary index of an ArrayList


I know that I cannot store a value at an index of an ArrayList that hasn't been used yet, i.e. is less than the size. In other words, if myArrayList.size() is 5, then if I try to do

Friday, February 10, 2012

Find duplicates in large file - java


I have really large file with approximately 15 million entries. Each line in the file contains a single string (call it key).