data-structures

How should a blog be structured to easily extract its data?

I'm currently using Wordpress to run my website. However, with each new release I become more concerned with software bloat and the convoluted table structures used to store my data. Maybe this is a fruitless pursuit. Features are always added to blogging software until it claims to be a CMS--and at that point your data is probably st...

Calculate the Hilbert value of a point for use in a Hilbert R-Tree?

I have an application where a Hilbert R-Tree (wikipedia) (citeseer) would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates. However, as far as I can see, none of the descriptions of the algorithms for this data structure even mentio...

Is this C++ structure initialization trick safe?

Instead of having to remember to initialize a simple 'C' structure, I might derive from it and zero it in the constructor like this: struct MY_STRUCT { int n1; int n2; }; class CMyStruct : public MY_STRUCT { public: CMyStruct() { memset(this, 0, sizeof(MY_STRUCT)); } }; This trick is often used to initiali...

How do I remove objects from an Array in java?

Given an Array of n Objects, let's say is an Array of Strings, and it has the following values: foo[0]="a"; foo[1]="cc"; foo[2]="a"; foo[3]="dd"; What do I have to do to delete/remove all the Strings/Objects equal to "a" in the Array? Thanks! ...

SQL Server Priority Ordering

Hi all, I have a table that contains tasks and I want to give these an explicit ordering based on the priority of the task. The only way I can think to do this is via an unique int column that indexes where the task is in term of the priority (i.e. 1 is top 1000 is low). The problem is that say I wanted to update task and set its prior...

Stable, efficient sort?

I'm trying to create an unusual associative array implementation that is very space-efficient, and I need a sorting algorithm that meets all of the following: Stable (Does not change the relative ordering of elements with equal keys.) In-place or almost in-place (O(log n) stack is fine, but no O(n) space usage or heap allocations. O(n ...

Set operation in .NET C#

I'm working on a something related to roughset right now. The project uses alot of sets operation and manipulation. I've been using string operations as a stop gap measure for set operation. It has worked fine until we need to process some ungodly amount of data ( 500,000 records with about 40+ columns each ) through the algorithm. I ...

Is a Python dictionary an example of a hashmap?

One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hashmap? If not, what is it? ...

What is the time complexity of indexing, inserting and removing from common data structures?

There is no summary available of the big O notation for operations on the most common data structures including arrays, linked lists, hash tables etc. ...

What is the best way to store set data in Python?

Hello Stack-Overflow, Here is my situation. I have a list of data that looks like this: [(id__1_, description, id_type), (id__2_, description, id_type), ... , (id__n_, description, id_type)) The data is loaded from multiple files that all belong to the same grouping. In each grouping there could be multiples of the same id, each comin...

.Net Data structures: ArrayList, List, HashTable, Dictionary, SortedList, SortedDictionary -- Speed, memory, and when to use each?

.Net has a lot of complex data structures. Unfortunately, some of them are quite similar and I'm not always sure when to use one and when to use another. Most of my C# and VB books talk about them to a certain extent, but never really go into any real detail. What's the difference between Array, ArrayList, List, Hashtable, Dictionary, S...

2d Data Structure in C#

I'm looking for resources that can help me determine which approach to use in creating a 2d data structure with C#. ...

How do I remove an element that matches a given criteria from a LinkedList in C#?

I have a LinkedList, where Entry has a member called id. I want to remove the Entry from the list where id matches a search value. What's the best way to do this? I don't want to use Remove(), because Entry.Equals will compare other members, and I only want to match on id. I'm hoping to do something kind of like this: entries.Remove...

Where can I find a Perl module for converting a Perl data structure into a JavaScript one?

e.g. (Mason code): 16 % # convert our @cti data structure into a javascript one 17 var cti = [ 18 % foreach my $cti_category (@cti) { 19 { 20 label: "<% $cti_category->{'label'} %>", 21 value: "<% $cti_category->{'value'} %>", 22 children: [ 23...

Best place to Sort a List of Tasks

Hi, Im building a web application which is a process management app. Several different employee types will be shown a list of Tasks to do and as each one completes a task then it is moved on to the next employee to work on. The Task hierarchy is Batch > Load > Assembly > Part > Task. There are currently 8 rules for determining which T...

Fastest small datastore on Windows

My app keeps track of the state of about 1000 objects. Those objects are read from and written to a persistent store (serialized) in no particular order. Right now the app uses the registry to store each object's state. This is nice because: It is simple It is very fast Individual object's state can be read/written without needing...

What is the best data structure in .NET for look-up by string key or numeric index?

I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas? ...

class with valueTypes fields and boxing

I'm experimenting with generics and I'm trying to create structure similar to Dataset class. I have following code public struct Column<T> { T value; T originalValue; public bool HasChanges { get { return !value.Equals(originalValue); } } public void AcceptChanges() { originalValue = value; ...

EventWaitHandle behavior for pthread_cond_t

I've recently seen the light of EventWaitHandle's powerful behavior in C# and decided to move some functionality in a sister application to do the same. The only problem is that the sister app is written in C. No big deal, I'm using pthreads, which have a pthread_cond_t datatype that allows for signalling. My only question is, is it pos...

Java: Arrays & Vectors

Hi guys, I'm used to working with PHP but lately I've been working with Java and I'm having a headache trying to figure this out. I want to save this representation in Java: Array ( ["col_name_1"] => Array ( 1 => ["col_value_1"], 2 => ["col_value_2"], ...