A data structure is a way of organizing data in a fashion that allows particular properties of that data to be queried and/or updated efficiently.
3
votes
1answer
56 views
My Quick sort examination
I had a test on sorting using quick sort algorithm, which I have implemented. It's working fine.
But my examiner is not satisfied. They say that the solution which I provided is not a proper ...
3
votes
2answers
58 views
Array-based queue implementation
Here I have implemented a queue. Is this a correct, efficient queue implementation? what issues are there if any and what can be done to make it better?
...
1
vote
1answer
64 views
Implement a generic Priority Queue in C++
I wrote a Priority Queue that is stored using a doubly linked list. The queue can return the head and tail of the list, and contains a print function that is only used for testing purposes.
I'd like ...
2
votes
3answers
261 views
Simple Chaining Implementation of HashMap
I'm practicing writing my own simple version of a Java HashMap. I don't have much experience with generics in Java.
...
2
votes
1answer
87 views
Follow up: Implementation of a generic Stack in C++
This question is a follow up to the question posted here.
From the answer in that question, I've improved my implementation and would like another code review. I've made a myriad changes including ...
-1
votes
1answer
80 views
Implementation of a generic Stack in C++ [closed]
I've implemented a generic Stack in C++. I would like a code review in regards to my code, especially on whether or not my implementation satisfy the following 4 ...
3
votes
1answer
30 views
Exercise to create an insertString function to linked-list
Working from 'Programming in C' by Kochan. I'm on an exercise in the chapter 'Pointers'.
This was the exercise:
'Write a function called insertEntry() to inset a ...
4
votes
2answers
100 views
Testing if array is heap
This method tests an array of integers satisfies to see if its a max binary heap. This means
each node is greater than or equal to it's children
each node has at most 2 children
the leaf nodes are ...
0
votes
1answer
60 views
Stack implementation with exceptions [closed]
I would like to know if this is a great stack implementation. I created my own exception. Was that a bad idea or unnecessary? Should I have just thrown a IndexOutOfBounds exception instead of my own.
...
3
votes
2answers
69 views
Proper Stack Implementation
I want to know if this stack is implemented properly. Previously I was told a Linked List contains an inner class that represents a node and the outta class that represents the structure. Does that ...
1
vote
2answers
58 views
Selection sort algorithm examination
I had an algorithm test.
I was asked Selection sort algorithm to program.
I coded it in javascript and shown to examiner.
But he was not satisfied, he said its too complicated.
I think I have ...
4
votes
0answers
32 views
Managing a programmatically accessible stack trace
VBA has a call stack... but there's no programmatic way to tap into it, which means in order to get a stack trace for a runtime error, one has to manage it manually.
Here's some example code that ...
2
votes
2answers
48 views
AVL tree insertion and deletion of nodes in C. 2.0
I asked a question yesterday, based on the answers to that question and some personal insights I was able to update the original code. which I am posting here to get reviewed. I also thought about ...
2
votes
3answers
109 views
Linked List in Java
Here is my implementation of a Linked List. I think it should be efficient because of the head node and rear node tracking. Please give any feedback on my implementation of Linked List.
...
4
votes
1answer
67 views
Stack implementation in ES6
Finally happy to see that now we can have iterators and generators. I also need to try to have private properties too so that we have well encapsulated data structures and I see that there are Proxies ...
3
votes
1answer
50 views
A receptive map queue
I've written a class I call ReceptiveMapQueue. It's purpose is to organize the internal structure of an AFKable RPG. It only has two public methods - dumping entries into the queue, and extracting ...
3
votes
2answers
139 views
AVL tree insertion and deletion of nodes in C
This is my implementation of AVL tree, it works fine. is there any thing that can be improved about addition and deletion procedures specifically when deleting the root,
...
1
vote
3answers
370 views
Bubble sort examination
I solved bubble sort in an exam, but the examiner wasn't satisfied with the solution. Please tell me why my solution is unsatisfactory.
...
1
vote
0answers
45 views
AVL Tree implementation in Rust
I'm mainly looking for tips in how make my code more idiomatic and elegant, but any general reviews are welcome.
...
4
votes
1answer
40 views
Building a nested tree structure from an ordered list
I have an ordered list in this format. The data is ordered by path so that the list will never contain a child before the parent in the list.
...
7
votes
2answers
137 views
Circular Buffer C++11 Implementation
Here's the implementation of a common data structure I use at work, mainly for logging purposes.
I tried to make it C++11-compliant, but even if this standard has been around for a few years, it is ...
2
votes
0answers
39 views
Building nested object structures from CSV input
I'm reading big csv files and mashing the lines into hierarchical objects for analysis and display. The csv might look like this:
...
0
votes
0answers
14 views
Movable object design in Haskell [migrated]
Suppose I have an object which has a point denoting it's location and shape.
...
1
vote
0answers
60 views
In-memory B+ Tree in C++
I know B+ trees are not meant to be use in memory, but I just implemented it as an exercise. I'm looking for a general review.
...
3
votes
1answer
27 views
Tracking orders efficiently using a Python class
I've written a Ledger class for a daemon process, which is supposed to keep track of an exchange's orderbook. My main concern is the way I keep track of the orders -...
4
votes
1answer
101 views
Using a LinkedList type of adjacency list to create the word game: WordLadder
Goal
The user puts in a starting word and an ending word. My code creates a ladder between these words of words that are different by one letter.
Start: gain End: fire
Output:
gain
gait
wait
wart
...
6
votes
2answers
140 views
Circular Buffer Implementation
I'm implementing a "live analytics" feature and I need to always keep track of the last N items that were added to a collection so I figured I'd make a circular buffer since I couldn't find one.
I ...
5
votes
3answers
271 views
Finding the duplicate with an array with 1,000,000 integers between 1 and 1,000,000
I recently had an interview and got to phase 2 which is a coding assessment. One of the questions was:
Given an array with 1,000,000 integers between 1 and 1,000,000, one integer is in the array ...
2
votes
1answer
36 views
Segment tree challenge
Here is my implementation of a segment tree with a sample driver file (I didn't make an update function because I didn't need it for what I was doing).
I'm a huge fan of geeksforgeeks, but I do not ...
3
votes
2answers
143 views
Connected components in an undirected graph in C#
My knowledge in graph theory is very limited. I have to look for elements in an (undirected) graph who are in the same connected component.
The idea is simple. First, build the graph. Then, allocate ...
0
votes
0answers
37 views
Dataframe helper in R
In order to have a "unified" (I realize how ambitious this actually is) syntax when working on dataframes, I wrote the following functions that is a general purpose dataframe set of tools in R.
...
0
votes
0answers
15 views
Add and merge 2D array items so no nested duplicates on the outer array
this.collisions is a 2D array containing a list of collisions that, when bodies collide, they should be added to it. Here's an example:
...
1
vote
1answer
54 views
N-tier application with BAL and DAL methods
I was just asking this question over here. I'm on a project in which I'm failing to see the point of how a previous developer made decisions. I HAVE taken over this project and wish to make changes.
...
7
votes
5answers
696 views
An ordered set in C#
I need a generic data structure that ensures that its elements are unique. C# has HashSet<T>, great!
As it turns out, the elements have to stay in the order ...
4
votes
1answer
74 views
Comparing three data structures for dealing with probability distributions in Java
Introduction
Suppose you are given three elements \$a, b, c\$ with respective weights \$1, 1, 3\$. Now, a probability distribution data structures will return upon request \$a\$ with probability 20%, ...
3
votes
1answer
68 views
2
votes
1answer
35 views
DisjointSet with O(1) find and O(1) amortised union
Does this code outperform the common implementation with path-compression and union-by-rank? I'm still okay with a review.
GitHub
...
6
votes
3answers
128 views
Generic graph implementation in C#
I am implementing fundamental data structures in C# while trying to learn techniques in the language to make my code cleaner, more concise, and reusable. I have implemented a generic graph with a few ...
3
votes
0answers
135 views
Data model for complex tree (multiple children and multiple parents)
I'd like to have a discussion on the data model (mostly) for a tree with nodes having multiple children and multiple parents.
I already have a working algorithm, but I'm looking for improvements.
The ...
3
votes
2answers
162 views
Heap Implementation in C#
I am learning fundamental data structures, and I want to know if this is a valid implementation of a heap. Can any C# features be used to improve or extend the implementation? In addition to heapsort, ...
2
votes
2answers
61 views
Importing data into Excel
Is there an easier way of importing data into an Excel array or other data structure? I've tried researching collections but I have found the documentation hard to comprehend.
MSDN
The code I have ...
4
votes
1answer
188 views
Data Stream as Disjoint intervals
I was asked the following question:
Given a data stream input of non-negative integers a1, a2, ..., an,
..., summarize the numbers seen so far as a list of disjoint
intervals.
For example,...
1
vote
3answers
92 views
RadixSet - A growing-only Radix/Patricia Tree
I'm looking for a structure to store large amounts of strings (5k to 100k) and then test for existence of new strings against the previous inserted data, in the least possible amount of time (memory ...
4
votes
1answer
78 views
Managing IDs using AVL trees
In a txt file there are IDs and next to them there are their neighbours like this:
1 1
1 2
1 3
2 1
2 4
2 8
3 5
Using AVL trees I store the IDs in one AVL ...
3
votes
1answer
44 views
Queue implementation using two stacks
Here's my code and I want to know if there's a better method for doing so. While the question has stated two stacks I wonder if we could do only with one as well?
...
4
votes
0answers
36 views
implementing a StringEnum
this is to be used like an Enum (as parameter mostly), but for string
using .net 3.5
Actual Implementation
...
4
votes
1answer
72 views
Clean Way of marshaling data
I've been working on a game that I used to play as a kid. This game was disassembled then converted to C# by someone else and they hosted it on Github. I've forked it and started working on it some. ...
2
votes
1answer
46 views
Flatten a nested dict structure in Python
For some post-processing, I need to flatten a structure like this
...
3
votes
1answer
40 views
Creating List of String elements that occur a certain amount of times using only the List ADT
I am tasked with creating a list with no duplicates of all String elements, in this case first names, of an ArrayList. The method is passed a threshold, and the ...
3
votes
2answers
103 views
Avoiding misuse of optional unwrapping: LinkedList
Below is my implementation of a generic linked list in swift. Unfortunately, Swift playgrounds won't run until the compiler is totally happy - often, that involves clang making me explicitly unwrap ...