data-structures

B-Tree Implementation - shall I make the Node class a static member class or not?

Here's my problem: If need to implement a B-Tree for University: I have an "outer" class B-Tree with attributes root and _degree. The class to represent the nodes is implemented as a static-member class: public class BTree<E> { private Node<E> root; // the minimal degree private int degree; public BTree(int degree) { ...

What is the most efficient data structure to store a list of integers that need to be looked up a lot in .Net?

I need an efficient data structure to store a list of integers. The amount in the list could range from 1 to probably never more than 1000. The list will be queried about 20 times per request. What would be the most efficient collection type to store these in? UPDATE To give a little more insight, we'll take www.wikipediamaze.com (a li...

Django Url structure for a Site

So I ran through a lot of Django tuts and I seem to understand the basics. I know everything about the urls.py. But now I need to design the urls for the whole site. It seems not as easy as I imagined. I would like to achieve the following. overall structure: main-site/ main_site/projects/ main_site/projects/project1 /...

Url Structure open source software

I am looking for an open source software that can create sitemaps/url structures. I know I can do it in e.g. in Illustrator. But maybe there is a special piece of software that lets me (once I put entered the data) do some more than simply display. Thanks ...

How can I find which jobs in a dependency tree can be run in parallel?

Currently, I am using a graph to store the dependencies and then running all of the vertices the don't have any dependencies. This works, but it feels kludgy. Is there a better algorithm or data structure I should be using? #!/usr/bin/perl use strict; use warnings; use Graph; #FIXME: naive implementation, there may be a much better...

median of BST in o(logn) time complexity

I came across solution given at http://discuss.joelonsoftware.com/default.asp?interview.11.780597.8 using Morris InOrder traversal using which we can find the median in O(n) time. But is it possible to acheive the same using O(logn) time? The same has been asked here - http://www.careercup.com/question?id=192816 ...

Building a Generic Parser for Converting a Text File to a Data Structure in C#

I have a definition for a SPAN file (http://www.cme-ch.com/span/spanl300.htm) that i'd like to use in constructing a parser to parse the string data into an in memory collection class (or even using lazy evalution with the yield keyword.) All parsing techniques and libraries i've seen apply to constructing parse trees for implementing...

Hashing a range

I have an array of range elements. Every element is has a start and an end. Within the array, the ranges are not overlapping, and they are sorted. i.e. (code just to illustrate, do not expect it to compile): var arr = { [0,3], [5,10], [15,59] }; Given a value (say 9), is there a hash function of the ranges that will allow me to quick...

Are there any go librarys that provide associative array capability?

I'm looking for a go language capability similar to the "dictionary" in python to facilitate the conversion of some python code. EDIT: Maps worked quite well for this de-dupe application. I was able to condense 1.3e6 duplicated items down to 2.5e5 unique items using a map with a 16 byte string index in just a few seconds. The map-rela...

How to efficiently store ever changing datasets (search results) for periodic reports

Hi all. I am having trouble coming up with a good way to store a dataset that continually changes. I want to track and periodically report on the contents of specific websites. For example, for a certain website I want to keep track of all the PDF documents that are available. Then I want to report periodically (say, quarterly) on the n...

B-Tree - I don't get the "minimal degree" thing

I'm trying to implement a B-Tree according to the chapter "B-Trees" in "Introduction To Algorithms"... what I don't quite get is the "minimal degree"... it says it's a number which expresses the lower/upper bound for the number of keys a node can hold. It it further says that: every non-root node stores at least t-1 keys and has t chil...

Are there hidden advantages to deep XML representations versus shallow representations with intra-document references?

I'm engaged in a debate over XML representations of groups of objects. Given an object hierarchy of entities like Artist, Album and Track, with a high amount of connectivity between the object, what are the pros and cons of formatting the XML representation of a given object graph with deep XML versus using object references. I'm fir...

stack using two queues

Possible Duplicate: Implement Stack using Two Queues I want the most efficient way in terms of time complexity to implement stack using two queues ...

puzzle using arrays

My first array M + N size and second array of size N. let us say m=4,n=5 a[ ]= 1,3,5,7,0,0,0,0,0 b[ ]= 2,4,6,8,10 Now , how can i merge these two arrays without using external sorting algorithms and any other temporary array(inplace merge) but complexity should be o(n).Resultant array must be in sorted order. ...

Know data type of the list elements

Hello, I have list of 5 elements. I get first element of this list. How can i kwno what's the data type of this element char* or int*? Thank you ...

Java text extraction and data structure design

I have a huge set of data of tables in Open Office 3.0 document format. Table 1: (x range)|(x1,y1) |(x2,y2)|(x3,x3)|(x4,y4) (-20,90) |(-20,0) |(-5,1) |(5,1) |(10,0) ... Like wise i have n number of tables.All of these tables are fuzzy set membership functions.In simple terms they are computational model's according to...

Java tree data-structure?

Is there a good available (standard Java) data structure to represent a tree in Java? Specifically I need to represent the following: The tree at any node can have an arbitrary number of children Each node (after the root) is just a String (who's children are also strings) I need to be able to get all the children (some sort of list /...

What would be a good hashCode for a DateRange class

I have the following class public class DateRange { private DateTime startDate; private DateTime endDate; public override bool Equals(object obj) { DateRange other = (DateRange)obj; if (startDate != other.startDate) return false; if (endDate != other.endDate) return false; ...

Weight-Biased Leftist Heaps: advantages of top-down version of merge?

I am self-studying Okasaki's Purely Functional Data Structures, now on exercise 3.4, which asks to reason about and implement a weight-biased leftist heap. This is my basic implementation: (* 3.4 (b) *) functor WeightBiasedLeftistHeap (Element : Ordered) : Heap = struct structure Elem = Element datatype Heap = E | T of int * Elem.T...

How do email programs/servers store and retrieve messages?

The speed of Eudora and GMail for instance in looking through thousands of emails and finding the right set of messages amazes me. I use Eudora and the search is so blazing fast at running through ten years of emails within a few seconds. So my question is, how do they store and retrieve messages? What data structures to store the data,...