Questions tagged [data-structures]

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

Filter by
Sorted by
Tagged with
-2
votes
0answers
54 views

What's the role of nil leaves in red-black trees?

In red-black trees, there is this idea that you should have nil (empty) leafs that are always marked as black. I don't quite understand their role, why have them in the first place? Is it not just an ...
-3
votes
2answers
73 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
139 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 ...
-2
votes
0answers
27 views

How to prove by formulas that rotation rule doesn't disrespect Red-Black tree's properties?

how can we mathematically prove that left-rotating or right-rotating a node in a red-black tree has no effects on it's BST attributes?
0
votes
1answer
78 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
82 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
49 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
50 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
30 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
67 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 ...
-4
votes
1answer
77 views

Is there any formula or trick to count how many times a statement inside a nested loop gets executed?

I am modifying a software which is for trash collection. While reading the code, I asked myself is there any formula or trick to quickly calculate the number of time the statement gets executed inside ...
-3
votes
1answer
69 views

Can TLV theoretically be used for browsers?

Compared with HTML (Hypertext Markup Language), TLV (Tag-Length-Value) also can be used for a data representation. If TLV is designed smart enough, it can represent hierarchies and trees with no ...
0
votes
0answers
43 views

What am I failing to understand about this adjacency list graph?

I am using this page to learn about an Adjacency List graph. The diagram shown makes sense to me: However, the code example's output has me confused. The input is this: struct Graph* graph = ...
1
vote
5answers
197 views

How do B-Trees used in databases sort data based on different fields?

I know majority of databases uses B-Trees, and I can see how using a balanced binary tree will give fast sort times, for ordering by ID or whatever else the primary key is; but how are databases able ...
-2
votes
1answer
156 views

Why would you make a struct without typedef?

Since I cut my teeth on code with OO, I’m biased toward using structs as classes without methods. However, there’s probably a good reason that typedef isn’t the default behavior of struct. What is it?
-2
votes
2answers
345 views

Why is “map with reverse lookup” not supported as a data structure?

I asked this question on StackOverflow recently: Is there a Map in Java that supports looking up Keys by (non-Unique) Value? As I suspected, the answer was "no", but I'm wondering why there is no ...
-1
votes
1answer
127 views

Is there existing technology write code to be executed in response to an email being sent for a certain email? [closed]

Similarly to a rest api, I want a server to listen for an email to an address I have created, and in response to mail being received, run code that I have created. Is this possible already? I ...
2
votes
1answer
68 views

Techniques for handling large reporting periods in MSSQL

We have a fairly large database with some fairly large tables (100s of millions of rows). Some of those tables are reported on. We have indexes in place to make this as fast as possible, but still ...
2
votes
2answers
62 views

How to model files which contain values that depend on and change with other values?

I want to parse a binary file and track the values and positions of certain properties within it. Reading them is not that much of a problem, since I know the rules they follow in terms of where they ...
2
votes
3answers
228 views

What is the name of this concept/design pattern for blocking another component from running?

Description of Desired Behaviour I have the following scenario: Component A can run freely as long as it is not blocked. Any other component can block the component A from running at any time. ...
-3
votes
1answer
105 views

How to do data design without database? [closed]

I already to do research on internet about data design, they all explain how to do data design with database. But how to do data design without database? example i want to do data design for embedded ...
2
votes
1answer
64 views

Storing and filtering spatial data within RAM

I'm trying to figure out what's the proper way of storing and filtering spatial data inside a running program. I have a 2D map of theoretically infinite size. Users generate objects which are placed ...
0
votes
0answers
19 views

Inspiration for Storing Error Codes and other State inside the “Value” of a bitarray

I am playing around with a toy database based on a large bitarray. I am considering storing special things inside the value (encoding sorta like a VLQ, Variable Length Quantity). Things like if the ...
1
vote
1answer
66 views

Converting binary tree into doubly linked circular list

I am a beginner in computer science and have been asked to write a program to convert a binary tree into a circular linked list (order of the nodes in list are in inorder traversal of the tree). I ...
1
vote
1answer
56 views

Ternary search tries vs. r-way search tries with hashtable child node list

I was watching the Coursera algorithms lecture series' portion on tries. R-way tries are introduced first, where each node has an array the size of the possible character space (R) with potential ...
1
vote
3answers
202 views

Are 'array elements' and 'array values' the same?

Array := {"title": "Book Title", "author": "John Doe"} Some people use the following terminology: title and author are keys. Book Title and John Doe are values. "title": "Book Title" and "author": ...
0
votes
0answers
11 views

Recommendations about Designing DDS Topics for IO Controller

I have an IO controller device which has up to 120 digital inputs/outputs. I want to use DDS to read inputs and to write outputs of the device. I have no idea how topics should be created. I mean, ...
1
vote
2answers
97 views

Tree data structure where children can only be added based on their type

I have a tree data structure where each node has a name, an id, a type and a number of children. Additionally each node has properties based on its type. Thereby each node with type A should only ...
3
votes
1answer
75 views

Is a generic data structure customary for use in a self contained program, or can I duplicate source files?

I have a project that does some Dijkstra searches on a graph, I implemented a red-black tree and priority queue that I use for the nodes, however I also need the same data structures for other things ...
1
vote
1answer
147 views

Does a Self-Balancing Self-Sorting Binary Search Tree exist?

When we are inserting into a self-balancing tree, can we also assume it is sorting itself using those same operations? Or rather is there a traversal method that gets us the elements as a sorted list?
2
votes
2answers
284 views

Is it allowed to calculate the derived attributes by using other tables' attributes directly?

I tried to build a database for Driver Booking system. Here's brief details: Drivers have several vehicles and they offers the driving service with them Drivers will charge different hourly rates on ...
0
votes
0answers
48 views

Most performant way to store and find overlap in (coordinate, id, time interval) triples

Let me explain what I'm doing. I have a grid based on integer coordinates like (5,5), (5,6) etc., and I have an algorithm FindCells that generates a list of (coordinate, interval) tuples. These ...
2
votes
1answer
229 views

Flexible (dynamic) user input vs statically typed language c#

Problem domain: There are different types of financial products and I am trying to simulate them in different scenarios. Each of the product types requires different input data. Suppose the input ...
2
votes
1answer
104 views

Designing the schema for a database of Spanish language words?

For a project I'm working on that will help people learn Spanish, I would like to create a standalone service to handle the retrieval of data about words. For this, I've captured and codified data ...
1
vote
1answer
52 views

Data modeling user-object permissions, between claims and metadata

I've been thinking about how to map user claims to permissions in a way that scales from a read and write perspective, probably using a stand-alone service. What we have today doesn't scale for ...
0
votes
0answers
56 views

What is the correct way of setting and then differentiating between paid and free user in Firebase / Firestore?

I am developing a mobile application that will have both free and paid versions. The way I see how I could differentiate between what is a paid and free user is to set a property isPaid on their ...
1
vote
2answers
98 views

How to manage item locations in an inventory

I have to manage item locations and life cycle as a new requirement. I'm not familiar in warehousing/inventory/storage systems, so maybe my question is trivial. The task: We have original items that ...
0
votes
2answers
143 views

Ordered data structure with efficient push, iteration and random pop/drain

I need a data structure d with somewhat conflicting requirements. What are the different tradeoffs I could pick? The same algorithm will be repeatedly done on each time step: push one new element to ...
1
vote
2answers
136 views

Architecture/algorithm for unusual recommendation system

There are thousands (or tens of thousands) of possible movie titles. New user enters my website and selects hundreds of titles that he likes. The only single goal of my website is to output the list ...
0
votes
2answers
210 views

What are the “scalar fields” and “composite fields” in JAVA?

Need to understand the below definition, from the protobuf tutorial: mergeFrom(Message other): (builder only) merges the contents of other into this message, overwriting singular scalar fields, ...
-4
votes
1answer
481 views

Exiting Recursive Function C++ [closed]

In the following function IsDoubleString(),if res is true then it shouldn't call IsDoubleString(), I debugged the code but I am unable to understand that once it hit the line returns res; why does the ...
1
vote
1answer
340 views

Designing an Entity Component System for interfacing with a scripting language

I am currently building an Entity Component System (ECS) in cython in order to speed up operating on large numbers of game objects in python. In the process of building this system, I ran into the ...
0
votes
0answers
61 views

Maintaining data: Unprocessed data, processed data, and results from processed data

I have built a python process which automates some portion of handling support tickets in Salesforce. I use selenium to extract all open support tickets and stores them in an archive. From that list,...
0
votes
0answers
17 views

spatial element count data structure eg: R-Tree, with filtering

Background: The application is a web map application with a LeafletJS front-end and NodeJS back-end with Postgres database. The application is to be used on both desktops and smartphones/ tablets in ...
-4
votes
1answer
98 views

Multi-level random selection implementation [closed]

Structure I have a structure like this: level 1 items represented by a capital letter (A, B, C, D,...) level 2 items represented by lower case letter (a, b, c, d,...) level 3 items repredented ...
3
votes
3answers
537 views

What is the most effective algorithm to evenly distribute n points on a 2 dimensional array so they are as separated as possible?

I am trying to code a game which currently uses a matrix ( that I am calling a map). On this map are islands which can be generated n times. The purpose of the algorithm is to distribute the islands ...
1
vote
2answers
40 views

Best way to model assay steps with low variability?

I have to process biological data input in the format of 96-well plates. explainer for the non-biologists: These plates are basically a 2D matrix of 8 rows x 12 columns of small cups called ...
-1
votes
2answers
124 views

Help designing a product model with vast amount of properties

I've been asked how to re-design a legacy system by a relative for a company that builds custom chairs. On their website you can customize your chair in about 30 permutations : chair type, material, ...
1
vote
1answer
155 views

Simulate running/resting heart rate BPM

I need to simulate & output the human heartrate BPM with real-world like values. I've been looking at a gaussian random approach but don't believe this fits my use case. I'm not concerned about ...
0
votes
2answers
55 views

Marrying disparate datasets in stream

Caveat: I'm conscious that this question may not be a great fit for stack-exchange platform as maybe 'too broad' but will try & structure it that it helps people in the future I have 2 event ...

1
2 3 4 5
17