Questions tagged [data-structures]

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

Filter by
Sorted by
Tagged with
2 votes
1 answer
423 views

What data structure is this?

Imagine I have a set of houses I want to sell and I want to present then on a website. The user should be able to filter the house they want by price, city, number of floors, area etc. However, I don'...
Mandrill's user avatar
  • 517
2 votes
4 answers
2k 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 ...
SOFe's user avatar
  • 708
2 votes
4 answers
4k 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 ...
Spencer Kormos's user avatar
2 votes
3 answers
564 views

What can Go chan do that a list cannot?

I want to know in which situation Go chan makes code much simpler than using list or queue or array that is usually available in all languages. As it was stated by Rob Pike in one of his speeches ...
alpav's user avatar
  • 129
2 votes
3 answers
2k views

Why did the C++ std library have a binary search tree well before a hashmap which is in many ways simpler

Looking at the two data structures and algorithms to handle them, a hashmap is not really any more complicated than a binary search tree and possibly less complicated. And the hashmap has the ...
user619818's user avatar
  • 1,767
2 votes
2 answers
4k views

Is it a bad practice to use JSON strings as keys of objects?

On languages such as Haskell, most datatypes have instances which allow their values to be used as keys of structures such as Maps. JavaScript has reasonably fast maps, there called objects, but those ...
MaiaVictor's user avatar
  • 5,830
2 votes
5 answers
9k views

An XML file or Database?

I am re-writing a section of my site and am trying to decide how much of a rewrite this will be. At the moment I have a web service feed that generates an xml once per day. I then use this xml file on ...
webnoob's user avatar
  • 2,149
2 votes
3 answers
832 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 ...
Kelderic's user avatar
  • 131
2 votes
1 answer
488 views

What is the "best practice" for converting an external API's data structure?

When an API's data structure does not fit well with an angular app, I am trying to determine the best-practice in my specific design and implementation for converting it to a usable structure. I was ...
hal's user avatar
  • 396
2 votes
4 answers
462 views

Generic term for "objects" vs "fundamental types"?

What are the exact terms to call data types with a logic structure (like C structures, C++ or Java objects) versus fundamental data types (like numeric types, characters, booleans...) independently of ...
Vincent's user avatar
  • 169
2 votes
1 answer
302 views

List structures in memory

Could anyone give an overview of how list structures which are composed of a head and a tail which references the rest of the list i.e linked list are represented in memory of the computer? Does the ...
cobie's user avatar
  • 3,237
2 votes
1 answer
3k views

Keeping binary search tree balanced

I am educating myself on algorithms and data structures. For that, I am doing a simple program that would read lines like this: bdhj 168.24 dahf 42.88 dhfa 128.92 First column represents an account ...
yasar's user avatar
  • 185
2 votes
2 answers
231 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 ...
Crashalot's user avatar
  • 243
2 votes
3 answers
542 views

Restful API design/ structure Decision

I´m currently creating my first restful API for a WebApp and I´m at a point where I´m not sure, how to best structuring it. Background Information I´m developing a Holiday planer for a Company. The ...
el solo lobo's user avatar
2 votes
1 answer
2k views

If I am using just HashMap can I override only hashCode method?

If I need to use only HashMap, why do I need to override equals() method along with hashCode()? How will not implementing equals() affect the working of HashMap?
karan ratnaparkhi's user avatar
2 votes
1 answer
602 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 ...
Martin Ueding's user avatar
2 votes
1 answer
78 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 ...
php_nub_qq's user avatar
  • 2,224
2 votes
2 answers
3k 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 ...
Lylant's user avatar
  • 31
2 votes
5 answers
1k 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 ...
Kartheyan's user avatar
2 votes
1 answer
316 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 ...
DavidY's user avatar
  • 189
2 votes
1 answer
887 views

Explanation of how to resolve Hash conflicts in HAMT or hashtables in general

I am working on trying to understand HAMT and now am uncertain generally what to do when you run into a conflict in a hash. All I understand so far is you create a list to append the keys to, but I ...
user10869858's user avatar
2 votes
2 answers
846 views

Is there any point in a digraph implementation?

The Foreword Hi! I'm just your average, fairly beginner, computer science student doing personal programming side projects, and who is probably out of his depth and has no clue what he's doing. So, I ...
Gry-'s user avatar
  • 39
2 votes
5 answers
1k 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 ...
J Trana's user avatar
  • 1,369
2 votes
1 answer
1k views

Best Data structure for implementation of dependent drop-downs

I want to implement dependent drop-down feature on a web page in my website containing the following drop-downs: User's group name Group events (dependent drop-down) Locations (dependent drop-down) ...
ekjot's user avatar
  • 21
2 votes
3 answers
201 views

Eliminating combinations based on user input

I am stuck with this particular problem. To give context to the problem, I am developing a mobile app which helps with loading dangerous goods onto a truck. Ignore the size and weight of the dangerous ...
Saul Goodman's user avatar
2 votes
1 answer
307 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'...
coney1's user avatar
  • 87
2 votes
2 answers
83 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 ...
Daniel's user avatar
  • 43
2 votes
1 answer
335 views

Tracking revision history by recording events

I've got a requirement to create a data structure that allows for users to view revision history. Not just the history of a table, but the history of the entire structure at a given point in time. A ...
mccow002's user avatar
  • 121
2 votes
1 answer
299 views

trie iteration should include root?

I'm working on a trie data structure. My simple, initial understanding: trie data structures require a fixed root node. This node cannot be deleted. When iterating through all nodes in a trie (in ...
Brannon's user avatar
  • 371
2 votes
1 answer
298 views

Parnas' Paper on Modularization and Workflow Engines

In a Software Engineering class, we had an assignment to read Parnas' seminal paper on modularization [0]. In this paper, two approaches of dividing a software into modules are discussed: Traditional ...
Patrick Bucher's user avatar
2 votes
1 answer
280 views

Should I add complexity to my POCO data objects to reflect their relationships, or wrap them in a more complex class?

I've got a set of immutable POCO objects that reflect database content. These have a one-many relationship: Property has one PropertyType, which has many PropertyTypeMetadatas. Because Property has ...
Joe's user avatar
  • 287
2 votes
1 answer
1k 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 ...
Ranger's user avatar
  • 148
2 votes
1 answer
280 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 ...
CodeYogi's user avatar
  • 2,166
2 votes
2 answers
219 views

C++ object references vs. lookup

Let's assume there are 2 classes: Country and City. Both of them have names, so a map would suit as conainer map<std::string, Country> countries; In the country class there is a similar map ...
Stefan Woehrer's user avatar
2 votes
3 answers
361 views

Pattern / methodology for representing large database records as objects

A bit of background information: We have an old database application written in Access that lets users monitor their workload, and the code is... 'procedural' might be too kind. The vast majority of ...
Kai's user avatar
  • 397
2 votes
1 answer
1k views

Marked nodes in Fibonacci heaps

I don't understand why Fibonacci heaps have marked nodes (picture). A node is marked when its child is deleted. Quoting from Wikipedia: "[Keeping degree of each node low] is achieved by the rule that ...
Alexei Andreev's user avatar
2 votes
2 answers
4k views

Count function on tree structure (non-binary)

I am implementing a tree Data structure in c# based (largely on Dan Vanderboom's Generic implementation). I am now considering approach on handling a Count property which Dan does not implement. The ...
Spevy's user avatar
  • 121
2 votes
4 answers
3k views

Data Structures usage and motivational aspects

For long student life I was always wondering why there are so many of them yet there seems to be lack of usage at all in many of them. The opinion didn't really change when I got a job. We have ...
Aubergine's user avatar
  • 137
2 votes
1 answer
151 views

Wondering about ADT abstract data classes in Python

I am trying to learn a little Python by myself and came accross this book Data Structures and Algorithms Using Python Rance D. Necaise 2011 , to get some proper/formal/correct definitions/terminology ...
pippo1980's user avatar
  • 137
2 votes
2 answers
90 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 ...
Samuel Ludwig's user avatar
2 votes
1 answer
95 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 ...
Chris's user avatar
  • 137
2 votes
2 answers
69 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 ...
Minix's user avatar
  • 149
2 votes
3 answers
281 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. ...
ianmandarini's user avatar
  • 2,818
2 votes
1 answer
211 views

Which programming pattern is best for checking which partition a number lies in?

I have an interval partitioned into “MECE” subintervals, and I want to check which subinterval a number lies in. (MECE stands for “mutually exclusive & collectively exhaustive”, meaning the ...
chharvey's user avatar
  • 264
2 votes
1 answer
2k views

Do we include output space in space complexity?

For example. I have a function which generates an array with random numbers. int[] generateNum(int n) { int[] result = new int[n]; /* Logic to generate random number */ ............... ...
Bhushan Jagtap's user avatar
2 votes
2 answers
213 views

Receive data in random order, send in order

I am facing an issue where I have a data stream that sends unordered data. I'm trying to find a way to receive the data in random order, but send it in order. As an example, I'll receive object4 and ...
Solidak's user avatar
  • 157
2 votes
1 answer
673 views

What is the best way to store message threads?

I'm integrating a messaging feature into an application written in Javascript and would like to know which is the preferred data structure of storing messages. The two structures I can think of so ...
Fried_Chicken's user avatar
2 votes
1 answer
931 views

Advantage of maintaining parent pointer - LCRS tree

In the below tree, typedef struct lcrsNode{ void *item; struct lcrsNode *parent; struct lcrsNode *firstChild; struct lcrsNode *nextSibling; }lcrsNode; typedef struct Tree{ lcrsNode *...
overexchange's user avatar
  • 2,265
2 votes
2 answers
5k views

Struct "prototypes" in (plain)C?

As the title says, can it be done? struct Room{ char *type; //Lecture hall, laboratory, etc. char *name; int *capacity; //How may people it can hold struct Building *building; }; ...
Rares Dima's user avatar
2 votes
2 answers
3k views

Can Two Binary Search Trees Have the Same Values but Different Structures?

Define a BST as: all left descendants <= n < all right descendants. Then is it possible to build two binary search trees with different structures but the same exact values? Duplicate values ...
Josh Pearce's user avatar

1
7 8
9
10 11
19