This question bugged me for years now and can't seem to find good solution still. I working in PHP and Java but it sounds like this maybe language-agnostic :)
Say we have a standard status reference table that holds status ids for some kind of entity. Further let's assume the table will have just 5 values, and will remain like this for ...
As a way to get used to python, I am trying to translate some of my code to python from Autohotkey_L.
I am immediately running into tons of choices for collection objects. Can you help me figure out a built in type or a 3rd party contributed type that has as much as possible, the functionality of the AutoHotkey_L object type and its m...
I have elements of a list in couchdb documents. Let's say these are 3 elements in 3 documents:
{ "id" : "783587346", "type" : "aList", "content" : "joey", "sort" : 100.0 }
{ "id" : "358734ff6", "type" : "aList", "content" : "jill", "sort" : 110.0 }
{ "id" : "abf587346", "type" : "aList", "content" : "jack", "sort" : 120.0 }
A view ret...
Hi All,
I have a question regarding implementation of smart-search features. For example, consider something like "smart mailboxes" in various email applications. Let's assume you have your data (emails) stored in a database and, depending on the field for which the query will be created, you present different options to the end user....
I'm having some problems deleting a node from a skip list. I have the following structures:
struct Node
{
int info;
Node **link_;
Node(int v, int levels)
{
info = v;
link_ = new Node*[levels];
for ( int i = 0; i < levels; ++i )
link_[i] = NULL;
}
};
struct List
{
int H; // l...
hi there,
I bumped into a case where I need a big (=huge) python dictionary, which turned to be quite memory-consuming.
However, since all of the values are of a single type (long) - as well as the keys, I figured I can use python (or numpy, doesn't really matter) array for the values ; and wrap the needed interface (in: x ; out: d[x])...
I need a data structure with the following requirements:
Needs to be able to get elements by index (like a List).
I will always just add / remove elements from the end of the structure.
I am inclined to use an ArrayList. In this situation, it seems to be O(1) both to read elements (they always are?), remove elements (I only need to r...
How to implement a buffer of the packets where each packet is of the form:
typedef struct{
int32 IP; //4-byte IP-address
int16 ID; //unique sequence id
}t_Packet;
What should be the most appropriate data structure which:
(1) allows to collect at least 8000 such packets (fast Insert and Delete operations)
(2) allows ver...
I need a data structure that
Must be ordered (adding elements a, b and c to an empty structure, will make them be at positions 0, 1 and 2).
Allows to add repeated items. This is, I can have a list with a, b, c, a, b.
Allows removing all ocurrences of a given item (if I do something like delete(1), it will delete all ocurrences of 1 in ...
Hi!
I'm writing a client program for a game in Javascript but I'm new in Javascript world. Core Javascript lack of high level data structures.
I've found code snippets on internet but I'm looking for a reference library (like commons-collection or google-collection in java world).
I found this post: http://stackoverflow.com/questions/...
I have the following requirements for a data structure:
Direct access to an element with the help of a key (Key will be an integer, range is also same as integer range)
Avoid memory allocation in chunks (Allocate contigous memory for the data structure including the data)
Should be able to grow the data structure size dynamically
Whi...
I have the following setup:
I have a largish number of uuids (currently about 10k but expected to grow unboundedly - they're user IDs) and a function f : id -> sparse vector with 32-bit integer values (no need to worry about precision). The function is reasonably expensive (not outrageously so, but probably on the order of a few 100ms f...
enum ID // IDs
{
ID_HEADER = 0, // ID 0 = headers
#include "DATA.CSV"
ID_LIMIT
};
I inherited some code here.....
Looking at "DATA.CSV" I see all the ID's used to populate the enum in column B, along with other data.
My question:
How does the enum know that it is u...
Hi,
I am writing a C program which is a frontend to a myriad tools. This fronted will be launched like this:
my-frontend --action <AN ACTION>
As all the tools have the same prefix, let say for this example this prefix is "foo". I want to concatenate "AN ACTION" to this prefix and exec this (if the tool exists).
I have written someth...
Possible Duplicate:
Container Class / Library for C
We have to maintain and even develop C-code of our legacy system. Is there good collection library that would support Java/C# (new versions) style collections. Hashtable, HashSet, etc. Of course without objects, but with structs. The HashTable key limitations to "strings" and...
I am looking for behavior tree implementations in any language, I would like to learn more about how they are implemented and used so can roll my own but I could only find one
Owyl, unfortunately, it does not contain examples of how it is used.
Any one know any other open source ones that I can browse through the code see some examples ...
I have come up with a data structure that combines some of the advantages of linked lists with some of the advantages of fixed-size arrays. It seems very obvious to me, and so I'd expect someone to have thought of it and named it already. Does anyone know what this is called:
Take a small fixed-size array. If the number of elements you ...
Hi,
I am having trouble picking the best data structure for solving a problem.
The problem is as below:
I have a nested list of identity codes where the sublists are of varying length.
li = [['abc', 'ghi', 'lmn'], ['kop'], ['hgi', 'ghy']]
I have a file with two entries on each line; an identity code and a number.
abc 2.93
g...
I have a series of items arriving which are used in one of my data structures, and I need a way to keep track of those items that are retained.
interface Item {}
class Foo implements Item { ... }
class Baz implements Item { ... }
class StateManager
{
List<Foo> fooList;
Map<Integer, Baz> bazMap;
public List<Item> getItems()...
Is there a way I can dynamically add data to a map in javascript. A map.put(key,value)? I am using the yui libraries for javascript, but didnt see anything there to support this.
Thanks!
...