Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [data-structures]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
36 views

Help required in the right data structure for faster look up of data

I have the below given data model itemid - name - collectionitemid example: itemid |name | collectionItemId ------------------------------- 101 | abc | null 102 | def | 101 103 | ghi | 101 ...
user avatar
  • 1
-3 votes
0 answers
31 views

Question on Data Structure [closed]

How to construct a Binary Search Tree from an In-order traversal of a Binary tree? For example the numbers below 2,11,20,24,33,56,80. My problem is to determine which of the numbers should be the root ...
user avatar
-1 votes
1 answer
124 views

Is there a standard way to "contract" the data format between the back and front components of an application? [closed]

I usually use a backend in Go and a frontend in TS/Vue - they exchange data in JSON. As my program is moving forward, I am changing the data format and need to do this both in the back and the front. ...
user avatar
  • 1,555
1 vote
2 answers
156 views

Efficient data structure to index a collection of unique values shared among objects

I have a collection of many millions of objects, each with a unique id, each composed of tens to thousands of values. Values in this case are simply arrays of floats, with dimensions in the tens to a ...
user avatar
51 votes
7 answers
8k views

Why do so many standards for JSON API response formats contain a "success" property in the response body instead of just using HTTP status codes?

I was researching about best practices for standardised JSON response formats for APIs, according to various sources available online general consensus looks something like this: //Successful request:...
user avatar
  • 629
0 votes
1 answer
224 views

Why is there no Hashmap in C++ like Java? [closed]

I know that the C++ standard library includes the ordered and the unordered map (std::map and std::unordered_map) containers, but why is there no hashmap available on C++? I was asked this questions ...
user avatar
1 vote
0 answers
132 views

Design MySQL database to store user workout data for Workout App

I am building a fitness app and I'm trying to figure out the optimal way to store the data is a MySQL database. I would like to have specific programs (for example, 'get jacked'), I would like a users ...
user avatar
  • 21
-3 votes
1 answer
99 views

Best way of organizing and storing this data in an explicit way? [closed]

I'm developing a free app to help people know how long to wait for their next bus in a specific itinerary of my country. I'm inclined to use Python and Kivy to deploy the app on multiple platforms. I ...
user avatar
  • 95
0 votes
1 answer
53 views

Data Class: spread boilerplate for each different database over multiple class copies, or add complexity to original class?

I'm creating a prototype mobile app that will store data locally in an sqLite database and also on the cloud (CloudKit for now). The cloud storage uses a certain way of storing the data, and sqlite ...
user avatar
  • 1,476
0 votes
0 answers
38 views

Query for each doucment or include IDs in document itself and query for all documents with ID?

I am working on a project where there will be different kinds of accounts that use Auth0 for auth and authz. I want to have it so that an account will query my backend to get back documents that ...
user avatar
  • 161
-1 votes
1 answer
92 views

A data structure / algorithm to combine search tree and hash table?

I have a two dimensional data with one dimension is ordered and another one is categorical, for example, country and city_age: country age city Italy 2773 Rome Germany 784 Berlin USA 397 New York ...
user avatar
  • 147
1 vote
3 answers
156 views

What makes a data pipeline scalable? Best practices for scalable design?

I have been searching about this topic for a few days and have not yet found anything on books, courses or tutorials. What is a way to make data pipelines more scalable, that doesn't involve NoSql or ...
user avatar
0 votes
0 answers
40 views

How to represent deeply nested data

I work on a project that has a lot of hard-to-grasp data shapes. I'm talking about lists nested as deep as 5 levels. Often I have to reorder the way that data is represented in these lists. For ...
user avatar
  • 109
4 votes
1 answer
366 views

Text adventure game: is there a more elegant way to store data & control logic?

so for the past several months, I've been working on a personal project. It's a comically large, highly open, handcrafted text adventure game packed with inside jokes and fun little surprises for my ...
user avatar
2 votes
1 answer
129 views

Should a data class manipulate its input?

Background I'm a scientist and trying to incorporate better software development practices in my work. In my niche field there's a standard model everyone uses that accepts a whopping 56 arguments. I'...
user avatar
  • 79
-1 votes
1 answer
95 views

Best way to store and fetch image bytes?

I have a case in my startup where I need to fetch images in bytes as fast as possible. At the moment I'm storing the images in Azure Storage then I fetch them on the run and cache them into my ...
user avatar
  • 107
0 votes
2 answers
66 views

Restructuring a “processing slip” like object used in many steps

I have worked on a library which processed data through multiple steps. It was written in R, a dynamic programming language where one could just add fields to existing “objects”, which were just ...
user avatar
3 votes
1 answer
326 views

What is the most suitable data structure for IPv4 addresses with intersecting ranges?

Mostly in all routers and operating systems the Longest Prefix Match algorithm is used for searching the trie of IPv4 addresses. Packet filters like Iptables don't need some special data structure for ...
user avatar
  • 113
2 votes
2 answers
87 views

Do calculations based off of already-included fields belong in a data-structure?

Say I have the following data-structure describing a given widget sold by my company, which contains fields of purely atomic information (i.e. data that cannot be otherwise derived from other ...
user avatar
1 vote
2 answers
135 views

Can you create a hash table made of binary trees?

For instance, if you have a hash table with the array of buckets 26 nodes long, one for each letter of the alphabet. You use that to keep track of names. So when a name "Jed" is added to the ...
user avatar
0 votes
0 answers
35 views

How to best process unreliable conditional data on the frontend?

For the past couple of weeks, I was working on creating a simple visual display of some data as bullet points. I already have a solution for the title but I wanted to post this question, to hopefully ...
user avatar
-1 votes
1 answer
104 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 ...
user avatar
  • 141
2 votes
1 answer
98 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. ...
user avatar
  • 29
0 votes
2 answers
230 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… ...
user avatar
  • 23
1 vote
4 answers
151 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 ...
user avatar
-1 votes
3 answers
225 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 ...
user avatar
  • 63
0 votes
1 answer
183 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 ...
user avatar
  • 111
1 vote
2 answers
288 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 ...
user avatar
0 votes
1 answer
45 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 ...
user avatar
  • 103
0 votes
2 answers
236 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 ...
user avatar
  • 441
0 votes
1 answer
127 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 ...
user avatar
  • 117
2 votes
2 answers
68 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 ...
user avatar
  • 43
-1 votes
1 answer
173 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 ...
user avatar
0 votes
1 answer
79 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 ...
user avatar
  • 11
2 votes
1 answer
354 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 ...
user avatar
1 vote
1 answer
247 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 ...
user avatar
1 vote
1 answer
99 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 ...
user avatar
4 votes
2 answers
240 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' ...
user avatar
  • 2,424
7 votes
2 answers
612 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 ...
user avatar
  • 183
0 votes
2 answers
116 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 ...
user avatar
  • 233
0 votes
0 answers
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 ...
user avatar
  • 37
6 votes
4 answers
309 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 (...
user avatar
0 votes
1 answer
140 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 | |------------------| | ...
user avatar
  • 119
-3 votes
1 answer
209 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. ...
user avatar
  • 105
0 votes
1 answer
117 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 ...
user avatar
1 vote
2 answers
105 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 ...
user avatar
1 vote
1 answer
171 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 ...
user avatar
-2 votes
4 answers
262 views

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

tl;dr - I've settled on the terminology Traversable for the container type which includes List and Dict but excludes str, and Atom for anything which is not traversable, e.g. cannot nest indefinitely. ...
user avatar
1 vote
1 answer
840 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, ...
user avatar
  • 160
0 votes
1 answer
871 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=...
user avatar

1
2 3 4 5
18