3
голосов
2ответов
1377 просмотров

Implementing and indexing User Defined Fields in an SQL DB

I need to store a large table (several millions or rows) that contains a large number of user-defined fields (not known at compile time, but probably around 20 to 40 custom fields). It is very important (performance-wise) for me to be able to query the data based on those custom fields: i.e. "Sel...

28
голосов
9ответов
23881 просмотров

Using a Python Dictionary as a Key (Non-nested)

Python doesn't allow dictionaries to be used as keys in other dictionaries. Is there a workaround for using non-nested dictionaries as keys? The general problem with more complicated non-hashable objects and my specific use case has been moved here. My original description of my use case was in...

1
голосов
5ответов
582 просмотров

How to best maintain a database of average time-related values?

I want to store the average values of some data that is occasionally generated by users, which I then use in my application to predict future data. Now the problem I have is that this data may grossly change during the day - so for example users coming in at night time may generate much lower val...

25
голосов
3ответов
29871 просмотров

Algorithm for merging two max heaps?

Is there an efficient algorithm for merging 2 max-heaps that are stored as arrays?

0
голосов
1ответов
1074 просмотров

A few Q's about Bloom Filter implementation

I recently discovered a site that set certain code kata. One of the Kata caught my eye and set me looking into Bloom filters. I'm using PHP and MySql. I have a table with roughly 45,000 words to act as a dictionary and i've written the code to create a bloom filter array. My questions are... ...

102
голосов
26ответов
42365 просмотров

Check if two linked lists merge. If so, where?

This question may be old, but I couldn't think of an answer. Say, there are two lists of different lengths, merging at a point; how do we know where the merging point is? Conditions: We don't know the length We should parse each list only once.

8
голосов
4ответов
856 просмотров

Programming to interfaces and synchronized collections

This question relates to Java collections - specifically Hashtable and Vector - but may also apply elsewhere. I've read in many places how good it is to program to interfaces and I agree 100%. The ability to program to a List interface, for instance, without regard for the underlying implementat...

10
голосов
19ответов
7585 просмотров

Distinguishing extra element from two arrays?

One of my friend was asked this question in an interview - You have given two integer arrays each of size 10. Both contains 9 equal elements (say 1 to 9) Only one element is different. How will you find the different element? What are different approaches you can take? One simple but len...

759
голосов
24ответов
407190 просмотров

How do you implement a Stack and a Queue in JavaScript?

What is the best way to implement a Stack and a Queue in JavaScript? I'm looking to do the shunting-yard algorithm and I'm going to need these data-structures.

33
голосов
9ответов
32066 просмотров

When to use a List over an Array in Java?

In Java, when would it be preferential to use a List rather than an Array?

88
голосов
4ответов
28268 просмотров

When to choose RB tree, B-Tree or AVL tree?

As a programmer when should I consider using a RB tree, B- tree or an AVL tree? What are the key points that needs to be considered before deciding on the choice? Can someone please explain with a scenario for each tree structure why it is chosen over others with reference to the key points?

2
голосов
3ответов
552 просмотров

Which data structure to add/look up/keep count of strings?

I'm trying to figure out what data structure to quickly support the following operations: Add a string (if it's not there, add it, if it is there, increment a counter for the word) Count a given string (look up by string and then read the counter) I'm debating between a hash table or a trie. ...

0
голосов
5ответов
209 просмотров

A C style string file format conundrum

I'm very confused with this wee little problem I have. I have a non-indexed file format header. (more specifically the ID3 header) Now, this header stores a string or rather three bytes for conformation that the data is actually an ID3 tag (TAG is the string btw.) Point is, now that this TAG in t...

1
голосов
3ответов
530 просмотров

Grep multi-layered iterable for strings that match (Python)

Say that we have a multilayered iterable with some strings at the "final" level, yes strings are iterable, but I think that you get my meaning: ['something', ('Diff', ('diff', 'udiff'), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')), ('Delphi', ('delphi', 'pas', 'pascal', 'objectpasca...

1
голосов
5ответов
2852 просмотров

Most optimal way to find the sum of 2 numbers represented as linked lists

I was trying to write a program for the problem I mentioned above, the numbers (i.e the lists) can be of unequal length, I was not able to figure out a way to do this other than the most commonly thought of approach i.e reverse list-1 reverse list-2 find the sum and store it in a new list rep...

37
голосов
19ответов
32595 просмотров

Circular buffer in JavaScript

Has anyone already implemented a circular buffer in JavaScript? How would you do that without having pointers?

1
голосов
3ответов
5638 просмотров

Client Access to SQL Server over the Internet

Does anyone have any opinions over the best ways to connect a client to SQL Server to get data. So lets say I have a C# DataGridView in a Winform not on the internal network and I need to load it with a lot of data. Currently to access the data we call a component SQLDataAdapter in the client w...

19
голосов
4ответов
7629 просмотров

Data structure for quick time interval look up

I have a set of time intervals In = (an, bn). I need to run lots of look ups where I'm given a time t and need to quickly return the intervals that contain t, e.g., those intervals such that an <= t <= bn. What is a good data structure or algorithm for this? If it matters, in my case the...

2
голосов
4ответов
643 просмотров

calculating a hash of a data structure?

Let's say I want to calculate a hash of a data structure, using a hash algorithm like MD5 which accepts a serial stream, for the purposes of equivalence checking. (I want to record the hash, then recalculate the hash on the same or an equivalent data structure later, and check the hashes to gauge...

1
голосов
2ответов
795 просмотров

Data structure to hold HQL or EJB QL

We need to produce a fairly complex dynamic query builder for retrieving reports on the fly. We're scratching our heads a little on what sort of data structure would be best. It's really nothing more than holding a list of selectParts, a list of fromParts, a list of where criteria, order by, gro...

8
голосов
4ответов
3387 просмотров

Storing Large Number Of Files in File-System

I have millions of audio files, generated based on GUId (http://en.wikipedia.org/wiki/Globally_Unique_Identifier). How can I store these files in the file-system so that I can efficiently add more files in the same file-system and can search for a particular file efficiently. Also it should be sc...

0
голосов
7ответов
3091 просмотров

Java: Pass by reference / ListIterator.add()

Java doesn't pass variables by reference. In that case, how do data structures like ListIterator make changes to their corresponding list? Here is an example iterator I am writing: public class OdpIterator<E> implements ListIterator<E> { private OdpList<E> list; priva...

1
голосов
3ответов
4300 просмотров

Haskell. Why are arrays faster than lists?

I am studying Haskell. I have the next question: The List type is a basic type in Haskell. Array in Haskell is based on lists. This is the list of indices [Ix a] and function presents by table - list of pairs [(Ix a,Value)]. Why is Array faster than lists, if inside it use lists?

4
голосов
2ответов
570 просмотров

Test Suite for a Linked List Implementation? (and/or other data structures)

For fun, I'm going to write my own implementations of common data structures like Linked List or Binary Sorted Tree. Are there any good test suites that already exist that I can use to make sure they are fully living up to their contracts? (It probably wouldn't be that hard to test them myself, ...

1
голосов
2ответов
283 просмотров

Actionscript 'Object' labeled as a real datastructure for readability

So in actionscript 3, instances of the Object class can be used an as associative array: var doNotHaveSexWith:Object = new Object(); doNotHaveSexWith['mum'] = new Person(...); doNotHaveSexWith['dad'] = new Person(...); doNotHaveSexWith['dave'] = new Person(...); Say I have some class, and one ...

3
голосов
6ответов
5079 просмотров

comparisons of data structures, algorithms, basic computer science, online resources

I am searching for an online resource referring to data structures and algorithms. Basicaly what I am interested in, is a kind of comprehensive list of things such as: when a data structure or algorithm is used, pros and cons compared to each other, real life-problem usage, etc. I have a couple ...

1
голосов
4ответов
1817 просмотров

Data structure for search engine in JAVA?

I m MCS 2nd year student.I m doing a project in Java in which I have different images. For storing description of say IMAGE-1, I have ArrayList named IMAGE-1, similarly for IMAGE-2 ArrayList IMAGE-2 n so on..... Now I need to develop a search engine, in which i need to find a all image's whose ...

22
голосов
7ответов
24686 просмотров

How can I maintain the order of keys I add to a Perl hash?

How can I maintain the order of actual list after counting its occurrence using a hash in the following program? For example, <DATA> are a b e a c d a c d b etc. Using hash, i counted the occurrence of each element. and what i want is: a 3 b 2 e 1 c 2 d 2 but the following p...

11
голосов
1ответов
6766 просмотров

Prove that binary trees with the same inorder and preorder traversals are identical?

Does anybody know how to prove that if two binary trees have the same inorder and preorder traversals, then they are identical? (perhaps by showing that you can't have two different binary trees with identical inorder and preorder traversals) Alternatively, show a case that would disprove this, ...

0
голосов
1ответов
151 просмотров

Biological Taxonomy Data Model

Looking for industry/standard data model for biological classification. Wikipedia