I am optimizing a part of a Delphi application where lists of objects are frequently filtered using different criteria. The objects are kept in TObjectList structures and it is common to select a very small percentage (ex. 1%) of the entire set with each filter. The total number of objects can be in the 100k range and during computations...
The dataset I want to read in contains numbers with and without a comma as thousand separator:
"Sudan", "15,276,000", "14,098,000", "13,509,000"
"Chad", 209000, 196000, 190000
and I am looking for a way to read this data in.
Any hint appreciated!
...
Hi,
This is one of the programming questions asked during written test from Microsoft. I am giving the question and the answer that I came up with. Thing is my answer although looks comprehensive (at least to me), I feel that the number of lines can be reduced. It was asked in C and I am a Java person but I managed to code it (my answer...
I need to analyze tens of thousands of lines of data. The data is imported from a text file. Each line of data has eight variables. Currently, I use a class to define the data structure. As I read through the text file, I store each line object in a generic list, List.
I am wondering if I should switch to using a relational database (SQ...
I have a simple requirement, i need a map of type . however i need fastest theoretically possible retrieval time.
i used both map and the new proposed unordered_map from tr1
i found that at least while parsing a file and creating the map, by inserting an element at at time.
map took only 2 minutes while unordered_map took 5 mins.
As...
I have specific requirements for the data structure to be used in my program in Java. It (Data Structure) should be able to hold large amounts of data (not fixed), my main operations would be to add at the end, and delete/read from the beginning (LinkedLists look good soo far). But occasionally, I need to delete from the middle also and ...
I am writing some and I need to pass a complicated data structure to some function.
The data structure goes like this:
{ 'animals': [ 'cows', 'moose', { 'properties': [ 9, 26 ] } ]
'fruits': {
'land': [ 'strawberries', 'other berries' ],
'space': [ 'apples', 'cherries' ]
}
}
This structure looks pretty ugly to me. Can you...
Are there any classes that can be queried / modified like a SQL DB but is entirely local and internal to the program?
I am aiming to write a program that needs to have a local data source with all data saved in a file, but I would like to be able to query this information store just as I would a DB; LINQ compatibility would be a huge pl...
I am trying to construct a general tree. Are there any built in data structures in Python to implement a tree?
...
Is there a recommended best-practice for storing content that has a complex structure. For example, suppose a typical "article" I am trying to serve may have the following hierarchy:
Header #1
Subheader #1.a)
Text content
Image content
Text Content
Subheader #1.b)
Text Content
Other complex content ty...
I was wondering if anyone could kindly help me on this seemingly easy task. I'm using nlminb to conduct optimization and compute some statistics by index. Here's an example from nlminb help.
> x <- rnbinom(100, mu = 10, size = 10)
> hdev <- function(par) {
+ -sum(dnbinom(x, mu = par[1], size = par[2], log = TRUE))
+ }
> nlminb(c(9,...
If I have a linked list structure, and I implement the clear() method as follows:
public void clear() {
firstNode = null;
size = 0;
}
will it still get correctly garbage collected, or would I want to walk through each node, setting nextNode to null?
None of the nodes can be directly referenced from outside the linked list, so...
Ive got some data (not that the data actually exists until after I solved this...) I need to be able to manipulate within my program. However I cant work out a suitable structure for storing this in.
The data represents a set of paths and nodes. There is one input (which may in some cases no be present) then a number of paths between no...
I'm writing a game in Flash (player 10) and need to come up with a good way to manage the list of objects/entities/actors in the game (player character, obstacles, enemies, etc.). It has these requirements:
Iterable
Objects addable and removable while iterating.
Argument to remove() function would be the object to remove, not an index...
Hi,
For my upcoming university C project, I'm requested to have modular code as C allows it. Basically, I'll have .c file and a corresponding .h file for some data structure, like a linked list, binary tree, hash table, whatever...
Using a linked list as an example, I have this:
typedef struct sLinkedList {
int value;
struct s...
Using an algorithm Tree-Insert(T, v) that inserts a new value v into a binary search tree T, the following algorithm grows a binary search tree by repeatedly inserting each value in a given section of an array into the tree:
Tree-Grow(A, first, last, T)
1 for i ← first to last
2 do Tree-Insert(T, A[i])
If the tree is i...
I've done a little research on hash tables, and I keep running across the rule of thumb that when there are a certain number of entries (either max or via a load factor like 75%) the hash table should be expanded.
Almost always, the recommendation is to double (or double plus 1, i.e., 2n+1) the size of the hash table. However, I haven'...
Possible Duplicate:
substring algorithm
Given two strings, A and B, how to find the first position of B in A?
For instance, A = " ab123cdefgcde"; B= "cde"
Then the first position of B in A is 5.
Is there any trick to solve this problem or just search A from the start?
...
I was wondering about the following two options when one is not using SQL tables but ORM based DBs (Example - when you are using GAE)
Would the second option be less efficient?
Requirement:
There is an object. The object has a collection of similar items. I need to store this object. Example, say the object is a tree and it has a co...
I am trying to implement a recursive splay tree, bottom up. I recurse down to the node I am need to splay up, and I find the parent and grandparent of that node. Then I am able to either zig zag or zig zig depending on the situation just fine. The problem is after this is done, I return the node which has been splayed once to the previou...