data-structures

a c program to add two singly linked lists, of unequal lengths containing single digited numbers in all of their nodes

i got this as an interview question. i was given 2 linked lists of unequal lengths,containing a single digited number in each of their nodes. i was asked to build a 3rd linked list which contains the sum of the two linked lists, again in the form of 1 digit in a node. ex: linked list 1 is 4-7-9-6 linked list 2 is 5-7 then the 3rd linked ...

Something like boost::multi_index for Python

Hi, I have come to appreciate a lot boost::multi_index in C++. It happens that I would happily use something like that in Python; for scripts that process data coming out from numerical intensive applications. Is there such a thing for Python? I just want to be sure that it doesn't exist, then I would try to implement it myself. Things ...

Where to save configuration data for custom CMS?

What are the benefits of storing different configuration data of a website: in database in file elsewhere? ...

How to store and retrieve lots of data for date-specific retrieval + summary retrieval?

Simplified case: Storage Users click on a link link_clicks +1 for each click Super user sets a multiplier parameter for each click link_reward (+1 * param) for each click User ID is also recorded for each click Retrieval Queries must be done on a specific date range (e.g., "How many click between Oct 10 and Oct 23 for User ID = 4"...

How to come to limits of 8060 bytes per row and 8000 per (varchar, nvarchar) value?

Comining from my question [1] where I was explained how to derive 8078 bytes of data per page in MS SQL Server. If to calculate the number of bytes per page used for data (without overhead) storage of only one row with one column of non-indexed fixed size type record (according to [1], i.e. [2]), then I come to 8087 bytes (per page)...

JSON List of Tags/Values

I am working on a project that requires an object to have multiple values. For instance, a list of 'things' all with a name but each thing also has another category, "Tags" with could include things like round, circle, ball, sport, etc. all words describing what the 'thing' is. I am trying to define this in JSON but I keep running into e...

data structure programming algorithm

how to draw binary trees whose preorder listing is abcdefgh and whose postorder listing is dcbgfhea.also,list the nodes of binary trees in inorder and level order ? ...

LinkedList implementation in Java with generics and enhanced for

Hi. I need you to review my implementation of a Singly Linked List (SLL) please. The implementation should use generics and be able to use the enhanced for. The problem is that, when I do for (Number n : list) being list a MyLinkedList<Integer> or MyLinkedList<Double>, I get the error: "Type mismatch: cannot convert from element type O...

SQL tree traversal

I am not totally sure I am naming this right, but please bear with me. I am wondering if is possible to do something like this in SQL(MySQL specifically): Let's say we have tree-like data that is persisted in the database in the following table: mysql> desc data_table; +------------------------+---------------------+------+-----+--...

Data Structure for Levels in Games

I am creating a platform game in JavaScript using canvas which is entirely tile-based. What is the best method of storing the blocks of items in the game (walls, floors, items)? The thing is every tile can be destroyed or created. Currently I have a 2D array so I am able to quickly check if an item is at a specific X & Y position. The ...

Concurrent map sorted by values with fast increment value operation

I have a web application where I need to keep track of "most popular" (most visited) articles. Most of the pages (including article pages) in that application displays "most popular" list in sidebar, so this list will be retrieved very often. On the other hand, articles are visited quite often too (approximately 1/2 of page visits are vi...

Trie data structures - Java

Hi, Is there any library or documentation/link which gives more information of implementing Trie data structure in java? Any help would be great! Thanks. ...

Why does the jQuery JSON parser need double escaping for backslashes?

I have trouble wrapping my head around a peculiar feature of the JSON data format. The situation is as follows: I have a string containing a Windows (sigh) directory path, backslashes escaped. For some reason, the jQuery JSON parser thinks that a single escape is not enough. <script type="text/javascript" src="http://ajax.googleapis.co...

I need a container that supports efficient random access and O(k) insertion and removal

I have tried again to ask the same question, but I ended up asking a different question by not providing essential information about my problem. I implement a data structure which is a tree. Each node of this tree has an array/vector/(random access structure) with all its children which can be arbitrary many. The insertion/removal of el...

Javascript: I need a good data structure to keep a sorted list

This would probably be implemented as a tree or something? My point is it needs to be efficient. I don't know where to find good implementations of data structures for Javascript for something like this, though. I don't want to have to roll my own if I can avoid it. Help appreciated. ...

Map and min-heap for better speed

Can a map and a min-heap used together give better amortized time that either on their own? Let's suppose I have a project where I need to track several items. These items have an expiration time and a unique id: class Item { ID uid; Time expiration; }; For this example, both Time and ID are primitive integral data types. I need ...

How to persist/store values at runtime.

I have a scenario which is as follows:- A form containing 2 grids. The grid on the left contains a list of groups. When a group is selected the grid on the right populates with another list with check boxes. I would like to be able to select group A and select some random check boxes and then switch to group B and select some other che...

Should I use structs in C++?

The difference between struct and class is small in C++, basically only that struct members are per default public and class members are per default private. However, I still use structs whenever I need pure data structures, for instance: struct Rectangle { int width; int height; }; I find that very convenient to work with: ...

Storing extendable options list in MySQL table? Best practice?

Hello, Let's suppose that we have multi-site CMS and every website in this CMS having 2 options: preview_width and preview_height. We know that every option should have default value if isn't defined by user. Also we know that list of options will be extented in near future. What is the best practice to store such options in MySQL table...

Intrusive or non intrusive

I am writing a multi threaded server app that requires stability and high performance. I'm looking at using Boost for some data structures I need. Is an intrusive data structure better or worse for something that should be thread safe and needs fast access, insertion, etc:::: ? ...