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.

learn more… | top users | synonyms (1)

3
votes
1answer
24 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
81 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
52 views

Stack implementation with exceptions [on hold]

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
58 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
54 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 ...
3
votes
0answers
23 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 ...
0
votes
0answers
17 views

Queue Implementation Java [on hold]

I have to implement a waiting room management system in an emergency ward of a hospital.This is done using queue.I am entering names of the patients..and an ID will be given to them randomly..lets say ...
2
votes
2answers
46 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
102 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
65 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
49 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
137 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
361 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
42 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
129 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
38 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
13 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
53 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
26 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
100 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
138 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
264 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
142 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
36 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
52 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
692 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
67 views

Simple singly linked list in Java

The list is pretty simple, here is my code: ILinkedList.java ...
2
votes
1answer
34 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
126 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
134 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
159 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
59 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
181 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
90 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
43 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
69 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
45 views

Flatten a nested dict structure in Python

For some post-processing, I need to flatten a structure like this ...
3
votes
1answer
39 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 ...
1
vote
4answers
378 views

Reading HTML files, removing HTML tags, and writing content and summary to a file

Write a multithreaded C++ application (executable) for Windows Platform. This program uses the two threads to read and process the input data and store it into an output file. Candidate is free to ...
4
votes
1answer
162 views

A one change boolean value

I have the case of repeated very similar logic that is used to check if a boolean value was changed from the initial value and prevent it from changing back, or to summarize multiple boolean return ...
3
votes
3answers
38 views

Array-based queue implementation using C

I wrote this header for generic use of a queue. The one thing I'm wondering is if I understood the usage of void*. I hope that if somebody teach me some conventions ...
3
votes
1answer
68 views

Running shell commands in a pipeline

I'm writing a shell in C for Linux and BSD. My code was unreadable before but I did a rewrite and now it is much more readable. The purpose of the code is to create a command pipeline and execute it. ...
2
votes
3answers
104 views

C++ Node class template

I'm working on building understanding of data structures in general, and specifically linked lists in this example. I'm also trying to increase my ability with templates. In cross-referencing dozens ...