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

learn more… | top users | synonyms

-1
votes
0answers
29 views

Developing a phrase bank to help people construct their CVs

I am currently developing the backend for a resume phrase bank which will help people construct their CVs by selecting a phrase from a large data set. I have decided to present the data in the form ...
-2
votes
0answers
27 views

Need help in optimizing my arraylist class which contains combination of pair [on hold]

Need help in optimizing my arraylist class which contains combination of pair: import java.util.ArrayList; import java.util.List; public class FieldsProvider2 { private MyObject object; private ...
14
votes
6answers
8k views

Which self balancing binary tree would you recommend?

I'm learning Haskell and as an exercise I'm making binary trees. Having made a regular binary tree, I want to adapt it to be self balancing. So: Which is most efficient? Which is easiest to ...
3
votes
3answers
113 views

How to represent a three-dimensional (or more) data structure in a terminal?

I am working on a library that allows the creation and manipulation of Vectors (lists with a known length), Matrices (lists of lists with known dimensions), and three-, four- etc. order Tensors (lists ...
18
votes
7answers
9k views

Is it a good practice to use smaller data types for variables to save memory?

When I learned the C++ language for the first time I learned that besides int, float etc, smaller or bigger versions of these data types existed within the language. For example I could call a ...
-5
votes
0answers
50 views

How to define a 2D array of structures in a private of a class? [closed]

I want to define a 2D array of structures in a class in C++, how should I do it, here is an example approach for a struct tt class{ private: int a,b; tt yum[a][b]; }; Can this be done in some way? ...
7
votes
2answers
156 views

Movable object design in Haskell

Suppose I have an object which has a point denoting it's location and shape. type Point = (Double, Double) data Object = Object { location :: Point , shape :: Shape } where a ...
68
votes
4answers
23k views

Which algorithms/data structures should I “recognize” and know by name? [closed]

I'd like to consider myself a fairly experienced programmer. I've been programming for over 5 years now. My weak point though is terminology. I'm self-taught, so while I know how to program, I don't ...
1
vote
4answers
164 views

Storing a straight line equation

How to store a straight line (infinite length, not a line segment) efficiently? This is not a duplication of How to represent a geometric line programmatically?, because the linked question is about ...
29
votes
5answers
12k 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 | ...
1
vote
2answers
158 views

What design patterns exist for large dataset manipulation within MVC for a rich client data grid?

I want to feed an HTML5 data grid with large data sets that the client will want to manipulate in different ways, e.g. aggregation, grouping, pivoting. The data comes from different web services and ...
5
votes
0answers
122 views

Modelling a complex schedule of work

I've got a real-world problem that I'm trying to represent and automate. I've simplified and abstracted it down to the following: There are n places of work (P1, P2, ..., Pn). Each place, Pn has a ...
4
votes
4answers
391 views

Why it is `(cons 1 (cons 2 (cons 3 nil)))` and not `(cons 3 (cons 2 (cons 1 nil)))` for [1,2,3]?

Is there any special reason that to construct list in Scheme you use (cons 1 (cons 2 (cons 3 nil))) instead of (cons 3 (cons 2 (cons 1 nil))) ? While the first seems more obvious because it ...
1
vote
0answers
70 views

high-dimensional index structures

I'm looking for information on searching (filtering) high-dimensional data. I'm not interested in nearest-neighbour search or clustering, but rather filtering/sorting by subset of dimensions - like in ...
12
votes
3answers
11k views

Difference between a heap and a priority queue

I always thought that heaps and priority queues were synonyms - an abstract data structure that supports the insert, findMin and deleteMin operations. Some literature seems to agree with me - Chris ...
0
votes
1answer
113 views

How can I avoid duplicating information in this scenario?

I have a Data class that can be placed inside a DataCollection class that can be placed inside a DataCollectionCollection class. Kinda like an egg can placed inside a box that can be placed inside a ...
0
votes
1answer
121 views

According to Clean Code, is it okay to add a single constructor to a plain data structure?

I have question based on the following fragments of "Clean Code". Those have been cited before, but I wanted to ask more basic question. 1. Data/Object Anti-Symmetry (...) the difference ...
1
vote
1answer
105 views

How to compare two objects for percentage of equivalence

I'm trying to create a nodeJS application. It allows users to rate a bunch of songs and it stores them in their user profiles. I use this information to compare them to other users, and try to find ...
1
vote
2answers
760 views

Shift bytes through a fixed sized buffer

I'm writing an InputStream that processes data streams containing "trailer" data. That is, the final n bytes of the stream is a piece of data that must be handled separately and shouldn't be returned ...
2
votes
2answers
113 views

Data structure to hold Excel column names with their values

I am learning how to read Excel workbooks in Java and want to know what a good Data Structure will be for holding Column names with the values under them. Example: I want to be able to call a ...
1
vote
2answers
199 views

Do any languages other than Haskell implement strings as linked lists of characters?

Haskell’s String type is an alias for [Char] (i.e. a linked list of Chars). Does any other language use an implementation of strings like this?
0
votes
0answers
16 views

Randomly sampling chunks of a tree

I have a (non-binary) tree from which I want to sample various leaf and non-leaf nodes semi-randomly. The tree is generally less than 50 leaf nodes in all. The criteria for sampling is somewhat fuzzy ...
7
votes
2answers
167 views

Data structure for two-dimensional board games in Functional languages

I am creating a simple MiniMax implementation in the functional programming language Elixir. Because there are many perfect-knowledge games (tic tac toe, connect-four, checkers, chess, etc), this ...
4
votes
1answer
177 views

Potential legal issues with lock-free / wait-free structures / algorithms

While researching the subject matter - lock-free and wait-free data structures - I'm seeing a worrying amount of mention of patents with this area. I've hobby-researched compression algorithms years ...
3
votes
1answer
52 views

Data structure to store breakable parts of a mesh

I have a wall mesh that is divided into destructible pieces. As it gets destroyed, the wall can collapse into separate objects with physics that can be destroyed as well. (Cut the wall in half ...
0
votes
0answers
46 views

Algorithm: Calculate average time in given time frame

I have a complex problem to solve. Problem Statement: I have a list of cities: Lets say New York, LA Las Vegas California The list of cities is limited, not more than 10. Now there are peoples ...
6
votes
2answers
93 views

Casting a nullary data constructor between types

Suppose I have a parametrized data type with more than one nullary (constant) data constructor, such as: data Check a = Valid | Invalid | Unsure a Sometimes I want to manipulate the non-constant ...
4
votes
5answers
208 views

How to store math expression in c++ list

I am parsing a infix math expression to a postfix form. I want to store it in a list like [4.5, 3, 0.25, +, -] so that I can process it once it's parsed. I could store it in a string again, but I ...
-2
votes
1answer
95 views

How do I implement autocomplete functionality for a big website? [closed]

I am looking to implement a custom autocomplete functionality for a travel website with huge amounts of data. I am thinking of implementing it using a trie. But how do I handle it if the data cannot ...
0
votes
1answer
65 views

Complex Math Formula: Predict the value of variable if result is known

I have a very complex math formula/equation which involves exponential. Formula: X + 2 = Y *PS: The above is just an example to illustrate my problem. The real formula is way more complex than this....
2
votes
3answers
183 views

Why are arrays often treated as second-class citizens?

In many programming languages, arrays don't get as much attention as other data structures. In Java, there is no Array<T> type collection to make arrays feel more consistent, such as in ...
0
votes
0answers
15 views

How to segregate data between user groups in Django?

django.contrib.auth has User and Group models. I'm using the User model for my users, and the Group model to manage their broad permissions (access to admin site, access logs, etc). I also have my ...
0
votes
1answer
108 views

Should smaller data types be used in intermediate code?

I often use smaller data types in structs/classes when it is needed in memory savings. I also use them in network/disk IO. My question is if intermediate code that use those objects with smaller data ...
2
votes
2answers
40 views

Composition of Data Transfer Objects

Let's say I want to create a shop/order system. I'll have an Order DTO to which I'll map the data from a request and results from the database. The object will consist of an order number, a customer ...
12
votes
4answers
3k views

Can a C struct behave like it had a function?

I use C and structs where a struct can have members but not functions. Assume for simplicity that I want to create a struct for strings that I name str and I want to be able to do str.replace(int i, ...
2
votes
1answer
140 views

Choice of variable names and types in graph algorithm

I am learning algorithms and data structures from this awesome resource Algorithms. Rather than doing dry reading I am trying to re-write all the code myself so that I can learn coding as well as ...
1
vote
1answer
64 views

Data Storage Architecture: Storing Hierarchical Data (JSON/BSON)

Say you have the hierarchical storage concept of "Foo." "Foo" holds an id, various values, and zero to many "Foo." Obviously, in turn, the child elements can hold zero to many Foos. The data is purely ...
0
votes
1answer
87 views

What data structure to use to save the address of edges in depth first search?

I am currently trying to write my own Depth First Search. I have created a class called node. class node{ private: bool is_visited; <data structure to collect edges> ...
1
vote
1answer
109 views

Understanding recursive solution of some algorithm

Most of the time we need to understand someone else' code for example I am studying Graph Algorithms from Sedgewick's online resources, the particular code example is taken from cycle detection ...
1
vote
1answer
52 views

Generate a string generator (constant associative array)

There is a finite set of unique strings and a limited key space. One key corresponds to one string value and a function must exist to perform the resolution. There is no need to support other ...
1
vote
1answer
51 views

Best structuring for IRC message decoding (Python)

I am writing a simple IRC chatbot in Python and, in an effort to get more into OOP, made a basic "connection" class that manages all the backing-and-forthing involved. But IRC protocol is rather ...
2
votes
2answers
148 views

C#/VB struct – how to avoid case with zero default values, which is considered invalid for given structure?

How to implement some constrained .NET struct/structure (let's say LimitedString), where its state with default values (set by CLR to technical defaults, i.e. nulls, zeros, etc.) should be prohibited ...
-1
votes
1answer
150 views

What is the faster way to save and browse objects using vectors +/or maps? (c++)

I'm doing a object Garbage class using c++: #include "Object.h" class ObjectGarbage { public: ObjectGarbage(); ~ObjectGarbage(); void Call_All_Objects() { //(...
1
vote
1answer
25 views

How do you achieve the 'BST Property' in a Template Binary Search Tree?

We recently started learning about binary search trees. We created one of our own using integers as our Key/Data. It's easy to achieve the BST property using an int key, but what happens when we ...
0
votes
1answer
63 views

Alert when size of continuous stream of events exceeds 1000

A friend of mine was recently asked this question in an interview. Lets say there is a continuous stream of incoming events E1, E2 each with timestamp of entry associated with them. Write a java ...
4
votes
1answer
55 views

Efficient Value-Lookup in List of k-Tuples

I've encountered a problem in a personal project that I think could be solved by a particular data structure but I'm not sure what. The problem is as follows: Given a set of k-tuples, provide an ...
2
votes
2answers
93 views

Best practices for getting data by different criteria

I have one BL function and one SQL stored procedure (let's name it: getPersonDetailsById) which returns person details by passing his PersonId. Now I need to get the same details (data table) but by ...
2
votes
0answers
43 views

Cache-conscious data structure that does not require hashing

I am looking for a cache conscious data structure that does not require hashing. This is to avoid HashDoS without needing to use cryptographic PRFs such as SipHash, which are slow (~1 cycle/byte) &...
4
votes
2answers
105 views

Database design, processor vs inconsistency

I was wondering, if I have a table that stores, lets say, a user's transactions, then when I need to fetch the user's current balance I would have to go and use SUM() like SELECT SUM(value) FROM ...
1
vote
1answer
119 views

Does algorithm time complexity O(5) considered as O(1)? [duplicate]

I have someone homework to make and in the instructions it says that we need to implement a function in O(1). Now, does it mean that I can make my function in O(5) or O(2) or whatever?