I have a data structure that I want to access / modify in different ways in different situations. I came up with this:
class DataStructure
{
public:
int getType();
private:
// underlying data containers
};
class WrapperBase
{
public:
void wrap(DataStructure *input)
{dataStructure = inp...
UPDATE:
Hey guys thanks for the replies. Last night and tonight I tried a few different approaches and came up with one similar to the one laid out below by Jeff (I had even already done what he suggested in his update, and put together my own simple LL implementation for additional gains). Here is the code, at this point it doesn't lo...
we have a data structure
struct MyData
{
int length ;
char package[MAX_SIZE];
};
where MAX_SIZE is a fixed value . Now we want to change it so as to support
"unlimited" package length greater than MAX_SIZE . one of the proposed solution
is to replace the static array with a pointer and then dynamically allocating
the...
I had been using Ternary Search Tree for a while, as the data structure to implement a auto complete drop down combo box. Which means, when user type "fo", the drop down combo box will display
foo
food
football
The problem is, my current used of Ternary Search Tree is case sensitive. My implementation is as follow. It had been used by ...
I want to create an adjacency matrix for a graph. Since I read it is not safe to use arrays of the form matrix[x][y] because they don't check for range, I decided to use the vector template class of the stl. All I need to store in the matrix are boolean values. So my question is, if using std::vector<std::vector<bool>* >* produces too mu...
I have a text field that can be 30 characters in length, however it can achieve around 2.000 characters.
For "future safety", it would be nice if this new column could support until 3.000 characters. I think the average size of this field is 250 characters.
Which SQL Server 2000 data type is better to increase performance and disk spac...
How would you structure the information which you maintain to keep all of the information about your projects and clients at your fingertips. We are finding that ours is becoming so large that at times we don't know for sure what we are looking for only that we know it is in the knowledge-base. We use a confluence in a classical hierarch...
I was thinking today about the best way to store a hierarchical set of nodes, e.g.
The most obvious way to represent this (to me at least) would be for each node to have nextSibling and childNode pointers, either of which could be null.
This has the following properties:
Requires a small number of changes if you want to add in or r...
One of my favourite data structures in college was the Trie. It's a great data structure for holding a large set of strings if the prefixes are shared. Lookups are also nice, since they are done at O(|length|) of the string regardless of how many strings are in the set.
By comparison, a balanced tree would be O(log N) in the number of s...
Hi there, I have been looking for C# examples to transform a DAG into a Tree.
Does anyone have an examples or pointers in the right direction?
Clarification Update
I have a graph that contains a list of modules that my application is required to load. Each module has a list of modules it depends on. For example here are my modules, ...
Dear all,
I have a data that looks like this:
>day11:1:356617
ACTTCTGATTCTGACAGACTCAGGAAGAAACCAT
>day11:2:283282
CTCAGCCCGTAGCCCGTCGGTTCCGGAGTAAGTT
>day11:3:205058
NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
>day11:4:202520
AGTTCGATCGGTAGCGGGAGCGGAGAGCGGACCC
>day11:5:107099
AGGCATTCAGGCAGCGAGAGCAGAGCAGCGTAGA
>day11:6:106715
CTCTTTGCCCCATCTACTGC...
Does anybody know if Python has an equivalent to Java's SortedSet interface?
Heres what I'm looking for: lets say I have an object of type foo, and I know how to compare two objects of type foo to see whether foo1 is "greater than" or "less than" foo2. I want a way of storing many objects of type foo in a list L, so that whenever I trav...
I am implementing a stack in JavaScript.
Consider:
Stack{0,1,2,3} Top:0
Now the user pops the value of 2:
Stack{0,1,3} Top:0
Is this an acceptable behavior for a stack?
I am rolling my own stack, but is there any built in code that would do this for me?
My Code:
function Stack() //Creating Stack Object
{
// Create...
Hi there,
I was wondering if anyone can provide some pointers on how to check for diamond dependencies whilst performing a Depth-First Search over a graph...I have the following graph A -> B, A -> F, B -> C, B-> E, C -> D, E -> D.
I am trying to construct a hirearchy of containers that represent the specified graph however when i reach...
I would like to know what copy-on-write is and what it is used for? The term 'copy-on-write array' is mentioned several times in the Sun JDK tutorials but I didn't understand what it meant.
...
Hi, I have created a couple of different structures in a program. I now have a structure with nested structures however I cannot work out how to initalize them correctly.The structures are listed below. Btw, thanks in advance for reading my post or posting an answer :-) :
/***POINT STRUCTURE***/
struct Point{
float x; //x ...
I have a class in my application that translates path tokens into fully qualified paths. For example: it can take a string like "%MYAPPDATA%" and return C:\Users\user.DOMAIN\AppData\Raoming\MyApp.
Alternatively, the class has an overload to the function that can take an enum instead of a string. For example: it can take the enum App...
What are "Splay trees”, “Red-black trees”, AVL Tree, B-Tree and T-tree?
looking for good implementations.
Thanks
...
I'm struggling to create a generic (or untyped) array in C (I'm aware that C++ makes this easier). In a nutshell I want to allocate an array to hold an array of a specific known type (at runtime). In the real implementation it depends on user input.
I've been trying to use a enum/struct scenario following the advice found in several Goo...
I have a data structure which essentially amounts to a nested dictionary. Let's say it looks like this:
{'new jersey': {'mercer county': {'plumbers': 3,
'programmers': 81},
'middlesex county': {'programmers': 81,
'salesmen': 62}},
'new york': {'queen...