Questions regarding efficient storing and representing data within a software application.
3
votes
2answers
193 views
Why Do B+ Trees Have a Minimum Occupancy of 50%?
As far as I can tell, the basic operations (add, delete, search) on a B+ Tree would function the same if minimum occupancy was 1, or 1/3, or any other function on node size.
All the sources available ...
0
votes
1answer
103 views
calculating the average of a value over a month
I am working on a project right now that is having me calculate monthly interest on a bank account. The way the interest is supposed to be calculated is as follows:
Use the daily average to calculate ...
0
votes
1answer
43 views
Efficient storing and multidirectional lookup of hierachical data
I make a game and among others I have nations, provinces, tiles and armies. Each army belongs to exactly one tile, each tile belongs to exactly one province, each province to exactly one nation. I ...
-2
votes
0answers
38 views
C: volatile struct versus volatile members of struct [closed]
Is this code:
struct mystruct {
int n;
char c[10];
};
volatile struct mystruct x;
equivalent to this one?
struct mystruct {
volatile int n;
volatile char c[10];
};
struct mystruct ...
0
votes
1answer
82 views
Handling the process of large-scale lists [closed]
What are the efficient ways to process huge lists (+10 millions), and things to consider while manipulating huge lists.
First question, when should I use recursion, and when I shouldn't. In both ...
0
votes
0answers
3 views
updating multidimensional pointers for radix buckets [migrated]
First post on Stackexchange, so - hi everyone.
I'll give a short background to my situation: Our professor isn't really helpful and doesn't quite know his things well, especially when it comes to ...
-1
votes
1answer
58 views
How implement a doubly linked list using single pointer inside? [closed]
struct{
int value;
int *pointer;
}
I want to make doubly linked list using the above structure.
0
votes
1answer
100 views
Method ordering
This is the type of question that one would probably get in an exam, but now it happens to be in the real word. :-) I would appreciate some advice regarding the datastructure/algorithm that can be ...
2
votes
0answers
61 views
Data structure well suited for duplicate entries
I'm in the process of getting to know (modern) filesystems. As part of it, I came across log structured filesystems that also handle allocations in a log structured way. I wonder how they handle ...
1
vote
1answer
39 views
Is it a good idea to use bloom filters for this scenario?
I have a theoretical social network where two people, A & C, can become friends if and only if, they have a common friend B amongst them.
The simplest solution is to iterate over the two lists ...
0
votes
0answers
24 views
Arduino ADC value and practices to store data to buffer
I'm writing Arduino application which has timer interrupt to acquire ADC value. Main loop has serial transmission procedure to send data from buffer.
I'm not sure how to store data in buffer. Best ...
1
vote
3answers
105 views
Database design: 4 types of users but have different functionality , separate or one table?
I have 4 types of users:
Admins ,
normal user ,
company ,
service provider
admins and normal user share some attributes (id .first name ,last name ,phone ,mail)
company and service provider share ...
3
votes
2answers
80 views
Process to generate hierarchical structure based on relational data?
I have a csv of employee ids, names, and a reference column with the id of their direct manager, say something like this
emp_id, emp_name, mgr_id
1,The Boss,,
2,Manager Joe,1
3,Manager Sally,1
...
1
vote
1answer
89 views
Best approach to a defined datastructure
I have a plain text file with some data that I can't change, so I have to create a datastructure to use in reading the file and with that datastructure do some thousands of interactions.
The file ...
1
vote
1answer
58 views
Data structure for traversing hierarchical hostnames
So, quite often I'll come across a situation where I'd like to process hostnames in a hierarchical manner.
For example, given a hostname "foo.bar.baz.example.com", I might want to compare it against ...
2
votes
1answer
85 views
Data structures and algorithms for a directed rooted tree with inherited properties?
I need to represent a directed rooted tree in memory. The caveat is, that nodes have properties.
And those properties are inherited (but not 100%) by the child nodes, recursively.
What would be a ...
2
votes
1answer
44 views
BloomFilter in ruby should have k hash functions
I am reading the Bloom Filter implementation written in ruby. It should have k hash functions, but it looks like the same hash function is being used with different seed values. Is this a common way ...
0
votes
1answer
31 views
What would be the return type of a cartesian product of a multiset
I am writing a Multiset in Ruby. The Union, Intersection operations where simple and return a MultiSet. But, I am not sure what the return type of the cartesian product should be, should I return an ...
3
votes
0answers
131 views
Lightweight data modeling vs traditional classes [closed]
I've heard a lot of talk about using lightweight data modeling as of late. Especially in relation to the Clojure programming language. What is it and how it differs from traditional classes regarding ...
4
votes
2answers
178 views
Decimal vs. Integer; Given a fixed range of values, which is preferable for accurate computation?
After getting into a "heated discussion" with someone, I figured I'd ask this question for the sake of posterity. I'm willing to be corrected if my assumption is incorrect but I'd like to hear a ...
1
vote
1answer
120 views
What was the influence of Chris Okasaki's data structures on Scala? [closed]
I heard a friend say:
The first real use of Chris Okasaki's book was in Clojure's data structures
I heard another friend say:
No, they influenced the design of Scala in quite a subtle way.
...
0
votes
3answers
128 views
At what level of abstraction are data structured created?
I am learning about Linked List and Arrays in my data structures class. We are make them in Java. Are actual data structures designed in Java/C? Or are they made in lower level languages like ...
8
votes
3answers
669 views
Clean Code and Hybrid Objects and Feature Envy
So I recently made some major refactorings to my code. One of the main things I tried to do was split out my classes into data objects and worker objects. This was inspired, among other things, by ...
0
votes
3answers
168 views
Is there a programming pattern, design pattern, or naming convention for moving data between related schemas? [closed]
I'm working on a web application that is publicly accessible. (Really) Long story short, we have two sets of tables in the database with relatively the same names and relatively the same data. The ...
3
votes
3answers
375 views
Separating Code into Smaller Files in C
I am in the process of cleaning up my code and making it easier to maintain. I am doing this by turning my 5000+ line file into separate smaller files.
I have successfully created separate source and ...
1
vote
4answers
407 views
How to work around Java's lack of pointers to pointers when working with linked data structures? [closed]
I've learned from a textbook how to implement binary search trees recursively in Java, and am working on implementing them nonrecursively. I've found a simple and elegant way to implement an insert ...
1
vote
1answer
136 views
How to efficiently sort a recursively defined Stack?
I am trying to implement a recursively defined Stack and sort it in Java.
I don't have a particular usage of this program in mind. I found this approach of stack implementation a bit useful while ...
-2
votes
1answer
161 views
What is the largest size a HashSet or TreeSet be? [closed]
So I am working on a solo project that involves a lot of strings. In one of my smaller test cases there will be at least 70 million elements. So my question is, what is the largest possible size a ...
-1
votes
1answer
216 views
Competitive Programming [closed]
I think this may just be one of the most frequently asked questions by a novice (like me) on this site. Please pardon me for that. My question is I wish to get better at solving the harder problems of ...
1
vote
4answers
118 views
Efficient “Object with weights” structure
I need to find an "efficient" data structure / set of algorithms to do the following things:
I have a list of objects. I need to assign them weights and later on increase or decrease these weights.
...
1
vote
1answer
101 views
Automatic denormalization for a NoSQL database application
We have a use case where we store table-like data, but we know about the schema of the data only at runtime. In our application, a power user defines a schema and normal user can create records and ...
0
votes
0answers
63 views
Converting a huge decision tree into a decision list for fuzzy matching
I'm trying to build an intelligent action bar similar to the command palette of Sublime Text:
The Sublime Text command palette allows fuzzy matching of commands in the list (e.g. "ancd vin" will ...
2
votes
1answer
43 views
I have an unordered list of rectangles and their neighbors on four sides with no origin. How can I efficiently convert this into a grid?
I am writing a GtkGrid-like container for my GUI library for Go, and I'm trying to write the actual layout part of the code.
Basically, I have an unordered list of controls. Each control is a ...
3
votes
2answers
380 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 ...
1
vote
2answers
647 views
2D linked list vs. multidimensional array/vector
I hope that programmers is the correct stack exchange for this, as it is quite a concept based question.
I'm working on a data structure in C++ that is a represents data in 3D space. The x-y plane is ...
2
votes
1answer
244 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 ...
2
votes
1answer
99 views
Tokenizing Text Held in a Rope Data Structure
I am building a text editor which makes use of a Ragel based tokenizer to support syntax highlighting. I am considering the use of a rope data structure to support efficient modifications and ...
2
votes
3answers
158 views
How exactly is an Abstract Syntax Tree created?
I think I understand the goal of an AST, and I've built a couple of tree structures before, but never an AST. I'm mostly confused because the nodes are text and not number, so I can't think of a nice ...
0
votes
1answer
86 views
How to make the members of my Data Access Layer object aware of their siblings
My team currently has a project with a data access object composed like so:
public abstract class DataProvider
{
public CustomerRepository CustomerRepo { get; private set; }
public ...
3
votes
2answers
108 views
Should I use nested matrices or dictionaries?
As per Should I ask my question about which data structure to use here? I'm asking this here. Hopefully this isn't too implementation specific.
I'm currently developing a program that will represent ...
10
votes
2answers
316 views
How to represent a graph with multiple edges allowed between nodes and edges that can selectively disappear
I'm trying to figure out what sort of data structure to use for modeling some hypothetical, idealized network usage.
In my scenario, a number of users who are hostile to each other are all trying to ...
3
votes
2answers
61 views
1 class model or 3 class models? 1 for each - UI, Hardware API Library, and Database
I've always used one class model in all 3 area's of my projects. User Interface, Hardware API (for data collection), Database (entity database context). Every new project only seems to grow in size, ...
2
votes
1answer
157 views
How to store satellite data in C data structutres
I've been reading through Introduction To Algorithms 3rd Ed, and am really enjoying the material; however, I am having difficulty in implementing some practical situations. It's not the theory, or ...
0
votes
1answer
62 views
How to chain together points in an array
I have a series of points with lengths and rotations like this:
I need to create separate chains from points whose lines overlap but I’m having real trouble doing this efficiently.
I have an array ...
0
votes
3answers
174 views
Why is the complexity of fetching a value from an array be O(1)?
How come the complexity of fetching a value from an array by it's index is O(1)?
I thought the algorithm has to go through all the indexes, find the correct index, and then know what value to return. ...
4
votes
2answers
185 views
Are bloom filters actually faster than hashes, even taking in account cache?
Bloom filters look really great when you consider you can determine if an Int is in a set with 99% certainty in constant time. But so can hashes, with the only difference that, in a hash, most of the ...
0
votes
2answers
139 views
boolean operations in C using bitfields
I am trying to implement boolean data type in C. Basically, I am working with sets.
The following code can be used to access each bit but I am unsure whether I can represent sets using this method.
...
1
vote
1answer
48 views
How should data transfer between a client and a web API for normalized data be designed?
I want to design an API backed by some database (doesn't really matter which, but to make the discussion more interesting, let's say it's Mongo - explanation below) which sends data to a client.
The ...
5
votes
2answers
169 views
Is it safe in Haskell to save a data structure to a file using “show”, and retrieve it using “read”?
Say I have the following types:
type EndsTup = (Int,Int)
-- (0-based index from start or end, Frequency)
type FreqTup = (Char, [EndsTup], [EndsTup])
-- (Character, Freqs from start, Freqs ...
0
votes
3answers
394 views
Nested maps vs. combined keys
in the project I am currently working on we had three different types of prices depending on the age of the user (adult, child, etc...). So we had on the DB a table looking like this:
PRICES
type ...