Hi,
Scenario is as follows:-
I want to reverse the direction of the singly linked list, In other words, after the reversal all pointers should now point backwards..
Well the algorithm should take linear time.
The solution that i have thought of using another datastructure A Stack.. With the help of which the singly linked list would ...
Hi,
Which data structure can perform insertion, deletion and searching operation in O(1) time in the worst case?
We may assume the set of elements are integers drawn from a finite set 1,2,...,n, and initialization can take O(n) time.
I can only think of implementing a hash table.
Implementing it with Trees will not give O(1) time com...
I'm writing a mobile phone based game in c. I'm interested in a data structure that supports fast (amortized O(1) if possible) insertion, look-up, and removal. The data structure will store integers from the domain [0, n] where n is known ahead of time (it's a constant) and n is relatively small (on the order of 100000).
So far I've c...
I am scanning over a large amount of data and looking for common trends in it. Every time I meet a recurrence of a unit, I want to increment the count of it. What is the best data structure or way to hold this data. I need to be able to search it quickly, and also have a count with each unit of data.
...
I'm looking for opinions on whether microformats should be used to name JSON elements. For instance, there is a microformat for physical addresses, that looks like this:
<div class="adr">
<div class="street-address">665 3rd St.</div>
<div class="extended-address">Suite 207</div>
<span class="locality">San Francisco</span>,
...
I realize my title is not very clear, but I am having trouble thinking of a better one. If anyone wants to correct it, please do.
I'm developing a data structure for my 2 dimensional game with an infinite universe. The data structure is based on a simple (!) node/leaf system, like the R-Tree.
This is the basic concept: you set howmany ...
Hi,
I want to use some kind of data structure in PHP (5.2), mainly in order to not pollute the global namespace. I think about two approaches, using an array or a class. Could you tell me which approach is better ?
Also, the main purpose would be for storing configurations constants.
Thanks
$SQL_PARAMETERS = array (
'server' => '...
I'm not quite sure stackoverflow is a place for such a general question, but let's give it a try.
Being exposed to the need of storing application data somewhere, I've always used MySQL or sqlite, just because it's always done like that. As it seems like the whole world is using these databases (most of all software products, frameworks...
Hi,
I was thinking of implementing a binary search trees. I have implemented some very basic operations such as search, insert, delete.
Please share your experiences as to what all other operations i could perform on binary search trees, and some real time operations(basic) that is needed every time for any given situation.. I hope my ...
I am referring to the algorithm that is used to give query suggestions when a user type a search term in google.
I am mainly interested in how google algorithm is able to show:
1. Most important results (most likely queries rather than anything that matches)
2. Match substrings
3. Fuzzy matches
I know you could use Trie or generalized...
Hi,
I new in database design, I want to be sure that i make it well.
Please take a look for part of my database design:
My database design for basic shopping cart:
//table that holds shopping cart items that customer choose(not press checkout and order //them)
**shopping_cart**
{
id (int)
product_id (int) fk
product_quantity (int)
cus...
Hi! I have a datastructure
struct record {
char cont[bufferSize];
record *next;
};
When I add new records to this structure, I want them to be sorted alphabetically. I made this function, that adds record in the right place (by alphabet) in the linked list:
record *start=NULL, *p, *x;
void recAdd(char*temp) {
p = new...
in my application user starts a new tree or get added under a child-user and keep on adding users in branches in such a way-
>there are 10 level of tree type structure.
>root node contain 1 user and each node(user) can have max 5 child-user in this way tree will be like level 0 = 1 user ,
level 1 = 5 user,
level 2 = 25 user ,
level 3 =...
def maxVote(nLabels):
count = {}
maxList = []
maxCount = 0
for nLabel in nLabels:
if nLabel in count:
count[nLabel] += 1
else:
count[nLabel] = 1
#Check if the count is max
if count[nLabel] > maxCount:
maxCount = count[nLabel]
maxList = [nLabel,]
...
I'm trying to implement a circular buffer in C, and have come across this example on Wikipedia. It looks as if it would provide a really nice interface for anyone reading from the buffer, as reads which wrap around from the end to the beginning of the buffer are handled automatically. So all reads are contiguous.
However, I'm a bit unsu...
I need to store multi-dimensional data consisting of numbers in a manner thats easy to work with. I'm capturing data in real time (processing live video frames every 40ms/10ms), and once processed I would destroy and GC older data.
This data structure must be fast so it won't hit my overall app performance. The faster the better (my alg...
When building objects that make use of data stored in a RDBMS, it's normally pretty clear what you're getting back, as dictated by the tables and columns being queried. However, when dealing with NoSQL, document-based systems, it's less clear what is being retrieved.
What are common methods of keeping track of structure in which data...
What happens when front==rear in circular queue
is queue have one element or is full or is empty
...
Hi,
I have few Gigabytes text file in format:
{"user_ip":"x.x.x.x", "action_type":"xxx", "action_data":{"some_key":"some_value"...},...}
each entry is one line.
First I would like to easily find entries for given ip. This part is easy because I can use grep for example. However even for this I would like to find better solution because...
I have a program that has items with 3 attributes.
Name(String) : Count(String) : Amount(String)
Currently I am writing the database when someone is trying to access a section then reading from the database. The writing is taking too long.
So my question is how can I perhaps create a nested array where I can say if name = carrot then ...