Questions regarding efficient storing and representing data within a software application.

learn more… | top users | synonyms

0
votes
0answers
58 views

Can I use write a null value into a file? Turbo C++ [on hold]

OK So I've been trying to create a manual database in C++. I have a structure called node, which has all necessary datatypes. struct node { int x; char y[100]; float A; }; now, I want the user to ...
1
vote
1answer
107 views

Why do Haskell and Scheme use singly-linked lists?

A doubly linked list has minimal overhead (just another pointer per cell), and allows you to append to both ends and go back and forth and generally have a lot of fun.
5
votes
1answer
144 views

Is there a design pattern for managing deep many-to-many relationships?

I'm having trouble defining this data pattern I've come across working on several applications. It consists of: An object type which is composed of many objects itself A second object type, where ...
1
vote
1answer
65 views

Combining simple and complex APIs in a web application?

We use C# MVC and Angularjs as the primary tools to develop our web applications. We've recently been discussing best practices, with an eye towards revising our development approaches into something ...
0
votes
0answers
22 views

Storing a many-to-many relationship between aggregate roots in a document store

Intro I'm currently facing a rather difficult problem. An application that we need to expand and partially overhaul, uses RavenDB as its storage backend (a NoSQL document store). The two most ...
-3
votes
0answers
35 views

Querying large number of timestamps [closed]

I have a list of timestamps in a table (there can be millions) of every time an auto-save event occurs. I want to track the amount of time people spend on a page, so every time they type a word, I ...
1
vote
1answer
147 views

Non-fixed-size Fenwick Tree implementation

I'm planning to implement a non-fixed-size Fenwick tree. That is, a Fenwick tree that allows interleaving range queries with adding/removing elements. All implementations and samples I've seen so far ...
1
vote
0answers
56 views

Detecting surface faces of a huge 3D mesh/grid

I've written a module in my application that creates a mesh from existing coordinate and face data. The number of vertices in the mesh could easily exceed 10 million and the same goes for the faces. ...
2
votes
4answers
88 views

Clean Abstract Syntax Tree

I'm writing a toy compiler for fun. Basically, my problem is that I don't want to clutter the AST with stuff like debug information (symbol tokens, locations of tokens, etc) as well as data that the ...
0
votes
1answer
154 views

What is an efficient data structure for syntax highlighting in text editors?

I'm creating a very small text editor in C++ with the ncurses library. So far, it works great. I have implemented the Gap Buffer data structure to make the editing more efficient than a line-based ...
4
votes
2answers
89 views

Mutable AST vs. different immutable ASTs

I am writing a toy compiler. During the semantic passes, I want to add information to the AST. Which of the following is the best approach? Define 1 mutable AST type whose fields are updated with ...
7
votes
2answers
3k views

Why does Python use hash table to implement dict, but not Red-Black Tree? [closed]

Why does Python use hash table to implement dict, but not Red-Black Tree? What is the key? Performance?
4
votes
1answer
54 views

What method should I use to populate a tree as I'm consuming data that is contained within the tree?

I have a tree that consists of 5 types of nodes - V, W, X, Y, and Z. V represents the root node, and a given tree has exactly one element of type V. A V contains one or more Ws, a W contains one or ...
-4
votes
3answers
343 views

How can the containsKey() method of a Java Hash Table be O(1)? [duplicate]

I had a very large ArrayList in Java, and I often need to check if it contains a particular value. This has proven very slow. Then I discovered that you can use a data structure based on a Hash. ...
0
votes
0answers
107 views

Enterprise Mashups. A good approach for .net

I'm in the middle of trying to talk our management into letting us do a portal that sits across the many, many systems that we use. I believe in using the best tool for the job so we have a good ERP, ...
2
votes
4answers
1k views

Is it possible to efficiently store all possible phone numbers in memory?

Given the standard North American phone number format: (Area Code) Exchange - Subscriber, the set of possible numbers is about 6 billion. However, efficiently breaking down the nodes into the sections ...
1
vote
1answer
33 views

How to represent alternative and sequential tasks?

I am experimenting with hierarchical task planning (in python) and I would like to have functions which return lists of tasks. I need to differentiate between alternative paths and sequential tasks. ...
1
vote
0answers
71 views

Search algorithm on sequential data model

For sequential data models like LinkedList, search algorithms like linear-search and binary-search are well known. Are their any other search algorithms apart from these two, that work on sequential ...
4
votes
4answers
286 views

Quadtree with duplicates

I'm implementing a quadtree. For those who don't know this data strucutre, I am including the following small description: A Quadtree is a data structure and is in the Euclidean plane what an ...
0
votes
0answers
20 views

What is the most efficient trie for comple multi-ligual data usage

Background Efficient Trie implementation for unicode strings I'm writing an app that will likely be run on systems that don't have much space or memory like my pi. Ideally my Trie would be efficient ...
4
votes
2answers
159 views

Merge directed acyclic graphs minimizing number of nodes

I have some DAGs (directed acylic graphs) and I want to merge them in order to minimize the number of nodes (we could say that every node has a cost, while edges are free). These four different DAGs ...
11
votes
1answer
5k views

Treating a 1D data structure as 2D grid

Hopefully this is a good question. I am working with a native class that represents a 2D image as a 1D array. If you want to change one pixel, for example, you need to now how to derive the index from ...
4
votes
2answers
316 views

Is this data model a list or tree?

Using python syntax with below environment diagram, teacher taught us that there are 11 trees(orange boundary) in this diagram, including leaf. It has been taught here, lists are represented as a ...
19
votes
5answers
8k views

Configuration data: single-row table vs. name-value-pair table

Let's say you write an application that can be configured by the user. For storing this "configuration data" into a database, two patterns are commonly used. The single-row table CompanyName | ...
0
votes
2answers
180 views

Is there a name for this data structure pattern consisting of a list of dictionaries each with one entry, consisting of an object? [closed]

There is a data structure idiom that looks something like this: [ { obj_1_id: { key1: value1_1, key2: value2_1 } }, { obj_2_id: { key1: ...
2
votes
2answers
37 views

How to manage ongoing data migrations?

I work in a SaaS project in which each user can have a representation of some common data at a given point in time. For the sake of example, let's consider that each user's data is metadata about them ...
2
votes
0answers
81 views

Efficient data structure to implement fake file system

I want to implement a data structure that will hold the paths of directories, sort of fake file system. Input:- I have a text configuration file containing the paths as follows ... C:/temp1 ...
6
votes
3answers
405 views

Hashing growth strategy

What is a good growth strategy for hash tables? If the number of elements exceeds the number of buckets, I increase the number of buckets with the following formula: n = int(n * 1.618033988749895) | ...
5
votes
1answer
386 views

How to store satellite data in C data structures

I've been reading through Introduction To Algorithms 3rd Ed, and I am having difficulty in implementing some practical situations. It's not the theory, or implementing the internals of the data ...
6
votes
1answer
389 views

Algorithm/data structure to answer “what recipes can I make with this set of ingredients?”

Formally, let s(U, Q) = {V | V ∈ U and V ⊆ Q} where U, Q, and V all represent sets, and U, more specifically, represents a set of sets. For the sake of example, U might be a set of the (sets of) ...
0
votes
0answers
44 views

Final array after M updates on Segment Tree

I am stuck in a middle of a problem. I have made segment Tree of N elements and performed M updates through lazy propagation Now I need to store the final array (to some array B of size N) after all ...
11
votes
3answers
26k views

Abstract Data Type and Data Structure

It's quite difficult for me to understand these terms. I searched on google and read a little on Wikipedia but I'm still not sure. I've determined so far that: Abstract Data Type is a definition of ...
11
votes
3answers
470 views

Do binary trees serve a specific purpose in storing hierarchical data? What is their canonical use?

I understand the structure of binary trees and how to traverse them. However, I am struggling to realize their actual uses, purposes in programs and programming. When I think about 'real life' ...
2
votes
0answers
60 views

How to handle complex calculated fields in an ORM

In our API we've got a few central datatypes which need to be "decorated" (so to speak) after retrieval from the database with calculated values. The database is accessed through an ORM which follows ...
12
votes
2answers
3k views

What is the relationship between data structures and algorithms? [closed]

I have been searching for a good online course in data structures but have found that Google also returns results for algorithms courses, which say stuff like: In this course you will learn ...
11
votes
2answers
3k views

Using a stream manipulator (endl) or a newline escape character (\n)?

I don't have a specific context in which I'm asking the question, but while I was reading a beginner book on C++ I noticed the use of both an endl stream manipulator and a newline escape character ...
3
votes
1answer
154 views

Providing views to an std::container

I want to maintain a buffer of 5 seconds of sensor data. The sensor data consists, among other things, of accelerometer readings in x,y,z dimensions, gyroscope readings in x,y,z dimension and ...
3
votes
1answer
149 views

How does a skip list work?

For a homework assignment, I need to understand how a skip list works. I've been programming for a little over 2 years now (I know that's not that long in reality), and I have never even heard of a ...
1
vote
1answer
76 views

Best practices for tracking multiple pieces of data in a program

I have a project in C (don't ask why but it needs to be in C), where I need to track multiple pieces of data and commands for different modules. Some actions that the program will take depend on the ...
0
votes
0answers
75 views

What exactly meant exactly by “to sort a stack in ascending order”?

There is an assumption made in solutions to this problem: Sort a stack in ascending order. The non-recursive solution looks like this: public static StackWithMin<Integer> ...
2
votes
5answers
413 views

std::vector Non-Array Implementation?

I've seen some posts on the StackExchange family of sites talking about std::vector implementations. They all seem to indicate that std::vector is implemented strictly as an array (in practice), and ...
1
vote
3answers
1k views

Does the Head(start) pointer of Doubly Linked list points previously to the tail(last) node

I have one question in my mind that in case of circular doubly linked list the head pointer of the doubly linked list also logically point to the next pointer of the tail node of the linked list and ...
-3
votes
1answer
161 views

Dictionary representation of an object

As python memory model is dictionaries of dictionaries, looks like any object in JavaScript has similar representation. Below code, > foo = {} makes foo as an empty dictionary {}. fine. If ...
0
votes
2answers
244 views

Name of data structure that's tree-like with multiple root nodes

I'm attempting to implement a data structure, and using a more traditional tree data structure, but I'm not using the root node as it holds no real value in the context I'm using it in. Ideally, I ...
0
votes
0answers
37 views

Algorithms for Academic Auditing?

I am trying to come up with an algorithm to perform academic auditing for college students. I never took an Algorithm course, any help is appreciated. Input: Degree requirements, Additional program ...
4
votes
1answer
160 views

How to store data that is recorded with different frequency?

I'm writing a metallurgical web application, that must store data (electrical parameters) recorded at different frequencies. For example: six parameters recorded with frequency of one measure per ...
1
vote
2answers
151 views

Efficient datastructure to create size-limited dictionary

I need a class that acts like a dictionary but will constrain the total number of key/value pairs it contains. For instance, let's say the maximum number of entries is 1000 and the class already ...
20
votes
3answers
2k views

How do purely functional programming languages deal with fast changing data?

What data structures can you use so you can get O(1) removal and replacement? Or how can you avoid situations when you need said structures?
0
votes
1answer
277 views

I need a data structure for a card game

I am programming a card game in java, and unsure what data structure I should use for the player's hand. I considered using an array, with one integer to traverse the array and another integer to ...
1
vote
2answers
158 views

Complex data structure in python: just dict, etc, or some classes?

Consider a web service API that returns a complex Json object. Using the stock Python tools for the job, this will read in from the web service as a dict which contains, in turn, a mixture of arrays, ...