People who code: we want your input. Take the Survey

Questions tagged [data-structures]

Questions regarding efficient storage and representation of data within a software application.

Filter by
Sorted by
Tagged with
-1
votes
1answer
50 views

search message in a conversation like messenger

I want to implement a search feature in my chat application like a messenger, skype, whatsapp has done. What they have done is when we search a word then it would not only show the message with that ...
2
votes
1answer
62 views

Implementing a persistent searchable “queue”

I'm receiving a lot of a data entries from different (IOT) devices. I need to temporarily and persistently store this data until it is polled by the matching clients, after which it will be deleted. ...
0
votes
2answers
98 views

About layered architecture and the persistence layer

I’m pretty sure I’ve made some wrong assumptions in my questions so bear that in mind. At some point, the methods inside objects that are part of the persistence layer will be called/accessed for say… ...
0
votes
4answers
109 views

Thinking about data as object vs table row [closed]

It often happens that we have a set of structured data. Let's say our data is about charitable organizations. I could turn it into a list/set of objects/structs: struct Charity { let name: String ...
-1
votes
3answers
207 views

Design pattern for creating and scheduling tests/exams

I have an Exam class that represents an examination/test: public class Exam { public int Id { get; set; } [Required] [StringLength(maximumLength: 30, MinimumLength = 1] public string ...
0
votes
1answer
95 views

How can I represent a graph for a visual programming language in JSON?

I am in the process of implementing a visual programming language similar to Blender's node editor or Unreal Engine Blueprints. It will be implemented as a SPA that will communicate with a JSON based ...
1
vote
2answers
136 views

Efficient set method in run length encoded C++ map

I have been designing a C++ class that maps an integer to an integer using a vector. Because there is a lot of repetitive data (for example 11115555666222), I am using a compression scheme where I am ...
0
votes
1answer
39 views

Best data structure for searching best color match? (4D space)

My current color distance formula is a modified version of Euclidian distance (eDist) because with eDist I was noticing weird issues where blue could be used instead of green in some situations when ...
0
votes
2answers
107 views

Which is the best data structure to use when you want to randomly pick elements & use them, but also delete them after use

I have 1000 lines in a text file. I want to read them into some data structure[DS]. After reading them, I will be randomly picking 50 lines from the DS (using a Random Number Generator). Next time 50 ...
0
votes
1answer
77 views

Data structures - prioritizing records based on pending actions

I need to add a priority column to an orders database to sort them, which will vary depending on what has already been done (actions taken). The other catch is: there are two different roles that will ...
2
votes
2answers
42 views

Make modifications to a database resource specific per company

Context I've been searching the internet to see if I could find any other information or posts about what I'm trying to achieve, but I had no luck. I don't know if there's a specific term or whatever ...
-1
votes
1answer
151 views

Should all structures be ADTs?

Is there any specific category an ADT must be in? I'm struggling to find out how best to represent objects in the program for example: As a record: struct Person { int age }; Or as an ADT: struct ...
0
votes
1answer
76 views

Custom datatype and their constructors - should you clone, or just copy?

Suppose we have the following C snippet, implementing a tree data structure: typedef struct node { char* data; struct node** children; unsigned int num_children; } node; Then we could ...
2
votes
1answer
210 views

Alternatives for index arrays

I work on a C++ project where I am not really happy with the data structures. The question isn't that specific to C++, I think that I would face a similar issue in say Java or Python. There are data ...
1
vote
1answer
89 views

How to separate public and private headers when internal data structures are private?

When developing a shared library in C, it is common to separate the "public" headers from the "private" headers. The public headers contain all the functions and types that are ...
1
vote
1answer
68 views

How to represent Spacial Time Series data in json clearly?

Currently, I have an application generating time series spacial data. The data is weather data with coordinates and a time of reading. I would like to receive chunks of the data in a time series way ...
4
votes
2answers
171 views

Arrays vs Maps for listing items that have a unique id

I've been finding that for a lot of code I've been writing recently, it naively might look like this: Array approach: const options = [ { id: 'red', label: 'Red', data: '#f00' ...
6
votes
2answers
599 views

some misunderstanding in concept of Huffman algorithm

What is difference between Average length of codes and Average length of codewords in Huffman Algorithm? is both the same meaning? I get stuck in some facts: I see a fact that marked as False: for a ...
0
votes
2answers
106 views

How can I associate algorithm-specific data to the objects it works with, efficiently yet cleanly?

I'm writing in C++, but this problem applies to most non-high-level languages, and possibly some high-level ones as well. I have a graph of heterogeneous nodes. The graph can be instantiated by ...
0
votes
0answers
35 views

Organizing Complicated Matrix Traversal?

The following are some examples that you may see in an intro to programming course: Print the elements of an nxn array... Spiraling in from the outside Spiraling out from the center Zig zagging from ...
6
votes
4answers
262 views

Is there an algorithm that performs better than O(n^2) for this unique pair tuple problem?

I'm trying to figure out if it's possible to have an algorithm that solves a certain problem in better than O(n^2) time. Specifically, I'm looking for an algorithm that, given two lists of two-tuples (...
0
votes
1answer
125 views

Does it make sense to have redundant DB fields to improve query performance, programming speed and code readability?

I am a bit torn about the database design for a solution. I have the following structure: (only the relevant fields are marked with #) +------------------+ | activities | |------------------| | ...
-3
votes
1answer
153 views

What data structure works best with File Explorer-type applications?

I'm working on a desktop application in C# that reads a directory and displays in a DataGridView the directory entries of the PDFs found in that directory, like a File Explorer that only shows PDFs. ...
0
votes
1answer
86 views

how to store the data for function f(time,length)

I have a function which has discrete time step ,discrete length from origin . These two give height of the function. For example at time 1.2sec , and length 5.5cm from origin height is 10cm. The step ...
1
vote
2answers
101 views

How should I design a database where each user can have ten lists with thousands of possible entries?

I am trying to design a database where each user can save up to ten lists of cards. Each list could theoretically have tens of thousands of items, but will likely only have hundreds. Should I create a ...
1
vote
1answer
165 views

What's an efficient way to serve hundreds of gigabytes of text records to search clients in C++?

I am building a three-tier architecture application that receives compressed (zlib) text records from a data store, decompresses the records into structs, and then serves the records to clients over ...
-2
votes
4answers
211 views

Is there a name for the data structure [object, list, primitive] e.g. JSON? [closed]

I am wondering if there is a terminology for the container data structure "isomorphic" to valid JSON, in other words, each item is one of: array/list object/dict/mapping leaf: something ...
1
vote
1answer
379 views

Python: Class vs NamedTuple vs Hybrid vs DataClass

So all four of these approaches to structure data on their surface work more or less the same to keep data well structured. Are there any reasons, be they hidden performance issues/enhancements, ...
0
votes
1answer
578 views

Efficient way to find Xor of pairs with given target X in a range 0 to K

I came across a problem: given an array (can be huge 10^8) and an integer, K, find the count of pairs in the array whose Xor equal to each value in the range 0 to K. eg: Arr = 1 2 3 K = 2 since K=...
9
votes
1answer
269 views

Data structure for multi key range queries

I need a data structure that gives the best performance for multi-key range lookups. I do not need to update/insert/delete. This will be immutable. The use case is in-memory filtering of values over ...
1
vote
1answer
139 views

How to exchange rectangular arrays via HTTP efficiently and without tightly coupling requesters to responders?

Suppose a user defines input arrays on a JavaScript frontend. These are sent to a Python backend via the REST API. The backend computes a result for every combination of each array's elements. It ...
0
votes
0answers
61 views

Time-indexed “array” of time spans

I have a list of objects that have durations, ProcedurePart Start: double Stop: double Instructions: string they occur sequentially after each other: stepOne stepTwo ...
-3
votes
1answer
154 views

Data structures or coding styles in C++ for avoiding long elseif chain when parsing?

Lately I have created some small parsers of data. My initial code structure // more cases here ... else if(!strcmp(X,"somekey")){ // Parse according to "somekey" behavior. } // ...
2
votes
2answers
138 views

API architecture design for fast reads of text file with 150m unique labels

Assume a text file with 150m unique records. Each record has two columns: (1) string and (2) integer. The string is a unique label, and the integer is the label's value. The only query will return the ...
1
vote
0answers
63 views

What is a good design for accumulating temporary data stemming from several processing runs?

I would like to compute cycle times for some manipulator movements. These movements consist of different phases. I have a class that models these phases and this is its constructor to give an idea: /**...
2
votes
2answers
238 views

Is the TreeSet class in java a Red Black Binary Search Tree?

I simply wanted to know if the internal implementation of the TreeSet class in java is Red Black Binary Search Tree. Ideally, I would think that it is a threaded RB-BST, since it supports iteration ...
0
votes
0answers
65 views

Does v8 have nested stack frames?

In chapter 4 of the Zone JS primer the following is mentioned: So far, we have discussed how zones are created, forked and how they maintain their state across asynchronous operations. Zones are ...
2
votes
3answers
242 views

Product Codes in ERP: Alphanumeric vs Numeric

Background I'm working through creating a structure for Items in a new ERP (Cloudsuite Industrial) that I'm implementing. For Items (which can be finished goods/products or raw materials), we ...
-3
votes
1answer
117 views

What's the argument against complex type hinting in interfaces in PHP?

The more I write OOP, the more I realize that besides reasoning & structure, there isn't much for me and things make more sense if I combine that with functional or just straight-up non-OOP. Not ...
0
votes
1answer
38 views

Organizing Data with Specific Group in Objects and Lists

So recently I have been working with a large-scale app that has a large number of individual objects with specific group attributes. For example, I have a list with objects such as {Name: "Todd", ...
-1
votes
1answer
85 views

Good representation for list of items that can be grouped together

I am building the frontend of a web app in JavaScript that manages list of past events. It basically has the following requirements: Events are displayed in a vertical list. Events can be moved to ...
-5
votes
1answer
102 views

What is the ideal data structure for 2D and 3D graphics in WebGL or Metal? [closed]

I have been thinking about this here and there for several years but haven't gotten around to having the time to actually implement it. I am getting closer to being able to implement a graphics ...
-3
votes
2answers
89 views

Recursion + Stack/Queue usage in practical life implementation [closed]

I am very new to Data Structures and Algorithms. I want to use recursion + stack/queue in a grocery store inventory program that I am making. However, I can't come up with any good ways of using ...
-2
votes
2answers
164 views

What is the correct use of -> operator when working with pointers?

I'm pretty new with C so I have encountered many doubts with pointers. I've already search a lot about this but there are some things that still are not clear for me, and I also think this will help ...
0
votes
1answer
1k views

What is the space complexity of a Python dictionary?

If python dictionaries are essentially hash tables and the length of hashes used in the python dictionary implementation is 32 bits, that would mean that regardless of the number of key-value pairs ...
0
votes
1answer
494 views

Decouple business logic from DTO

I've to implement some Backend Webservices, which provide a given, final JSON structure, which is allready in use on the FrontEnd side. This structure doesn't match the database structure, so I have ...
1
vote
1answer
51 views

Storing, indexing and searching data using Azure with frequently updated fields. Multiple Sources

We have a multi-vendor marketplace (e-Commerce) system and plan to move our data structures into a polyglot architecture to improve the performance of reads (critical) and writes (not as critical). ...
-2
votes
1answer
66 views

Optimal Data Structure for Searching though String

I am current developing a karaoke app in JavaFX, I need advise on the most optimal data structure storing a huge list of songs (library). I am inclined to use Binary Search Trees due to its Big O ...
0
votes
0answers
41 views

Is it idiomatic to use protobufs as containers within a service?

I love gRPC, but I find every step of the protobuf process rather frustrating (particularly in Python). Even though they are structurally similar to data structures composed of lists and dicts, you ...
-1
votes
1answer
70 views

Defining characteristics of mutable data structure objects

Assume we have data structure objects - some of them are DTOs and some of them are VOs. Also assume that Value Objects are immutable and Data Transfer Objects are immutable and readonly, then: How ...

1
2 3 4 5
18