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)

1
vote
1answer
28 views

Matching parenthesis

This is a simple implementation of a parenthesis-matcher. Given an expression, I want to find out if it is balanced.For example, the expression '{{[[()]]}}' is balanced while '{]{{}}]]' is not. I will ...
1
vote
0answers
17 views

Reformatting a structured string like “a-b-c|A-B-C” into “a-A|b-B|c-C”

The code below was inspired by this post in Code Review. Here is how it was first intended by its author: I have the following code that converts a string that looks like : ...
3
votes
2answers
50 views

Implementation of stack

Task: Create a class RPNStack which represents a stack of objects of type Node. Class RPNStack contains only one private field top of type Node. Objects of type Node represent data that ...
2
votes
1answer
60 views

Persistent set (Red black tree)

This is a partially persistent data structure using a red black tree. It will copy \$O(lg(n))\$ items for each remove or add operation. ...
0
votes
0answers
20 views

Implementation of a VList [closed]

Here is a VList I have implemented (gist): ...
-5
votes
0answers
38 views

How is my downheap algorithm? [closed]

I am attempting to downheap on an array from the last interior node all the way up to the root, so that I am making mini-heaps from the bottom up. I have an algorithm that I believe will do this ...
3
votes
1answer
35 views

Simple stack structure in C

I just started to learn C, and for practicing, I tried to implement a simple stack data structure, and I want to know if I'm making any mistakes, or how could I improve it: My stack.h: ...
3
votes
2answers
61 views

C Stack data structure

I have implemented a Stack data structure in C and I would like to know if there is something that could be improved. Stack using linked list: ...
3
votes
0answers
32 views

Refactored version of Okasaki's skew-binomial heaps in Standard ML

In his book, Purely Functional Data Structures, Chris Okasaki provides an implementation of skew-binomial heaps (p. 137). Unfortunately, the book isn't (legally) freely available anywhere, but his ...
1
vote
1answer
52 views

Templated linked list in Java

I recently reviewed some data structure concepts, so I implemented my own templated linked list. I am very interested about the code efficient and performance. ...
2
votes
1answer
47 views

Skip list in Python

I've made an attempt at writing a skip list in Python. I'm using NumPy to generate geometric random variables, but since that's a bit of a heavy dependency to drag around I could easily implement that ...
5
votes
1answer
73 views

Octree for voxels

I am creating a game with destructive terrain. Before I used a flat array to store the blocks, in chunks of 32^3. As I am aiming for detail and long view distance I would of course need some sort of ...
3
votes
1answer
158 views

Fibonacci heap in C

(See the next iteration.) I have rewritten a Fibonacci heap implementation from Java to C. fibonacci_heap.h: ...
8
votes
2answers
126 views

Report Building (Data Retrieval, Validation, Aggregation, Business Logic, Report Building, Visual Presentation)

This: Is a data table we get from our financial platform with lots of useful information. For reference, "--" is also the string they use to denote empty values. This: Is a spreadsheet I built ...
2
votes
2answers
32 views

Draw a graph using braille characters

I hacked together a way to make a small graph using Braille unicode codepoints by abusing unicodedata: ...
1
vote
1answer
75 views

Optimum Tree traversal algorithm Topcoder

I'm practicing a 1000 point algorithm problem on the topcoder.com arena. The problem is as follows:      You work for an electric company, and the power goes out in a rather large apartment complex ...
3
votes
2answers
67 views

Generic Singly Linked List in C

I decided to learn generic programming in C (and take a break from templates in C++) by implementing my first simple data structure in C : the singly linked list. What I'm looking to gain out of ...
4
votes
0answers
29 views

Hash Based Data Structure in Java for Collision Calculation

I have started a project on my free time were I'm writing a 2D game engine in Java. One of the more challenging and interesting aspects of such a project is collision detection between sprites on the ...
8
votes
2answers
136 views

Vector Implementation C++

I have attempted to implement a similar version of the STL Vector; several functions are missing but I'd like a few words of advice on whether I am indeed on the right track or whether I should change ...
6
votes
2answers
116 views

Skip List implementation

Skip lists are a probabilistic alternative to balanced trees, they are balanced by consulting a random number generator, that determines how many pointerscalled node level to successive elements a ...
2
votes
0answers
22 views

Repetative object attribute definition [closed]

The concept of "defining an object which holds repetitive information" has been something on my mind for quite a while, and I've come across it again recently. Hoping that someone can inform me on ...
3
votes
2answers
169 views

Phonebook implementation in C

I have implemented a phonebook in C using a singly linked list sorted data structure. This is my first average-major project. I need some reviews so that I can improve my coding standards. The ...
0
votes
0answers
30 views

Struct data validity checking

I work developing bench test for devices, and for one of them I have to send data that configures one of his behaviours, that behaviour being how the device tries to reconnect to the power grid. ...
5
votes
2answers
68 views

Remove duplicates from unsorted linked list

Remove duplicate elements from linked list. ...
7
votes
1answer
203 views

Generic “reduceBy” or “groupBy + aggregate” functionality with Spark DataFrame

Maybe I totally reinvented the wheel, or maybe I've invented something new and useful. Can one of you tell me if there's a better way of doing this? Here's what I'm trying to do: I want a generic ...
5
votes
2answers
243 views

Linked list in C

I'm trying to get into C, and I was wondering if I messed up regarding correctly implementing a linked list. node.h ...
3
votes
0answers
44 views

Updatable priority queue

This is an updatable priority queue. In contains an index (implemented as std::unordered_map) which maps a value to its position in the queue itself. The queue is ...
10
votes
1answer
141 views

Binary heap performance optimization

I have implemented a binary heap as a exercise in data structures. I realize that I'm missing some useful functions (increase/decrease key for example) but I don't consider them interesting for the ...
10
votes
1answer
82 views

Simple Oriented Graph implementation in Java

I wanted to implement a simple oriented graph as part of an exercise in both Object Oriented Programming and Data Structures. I wanted to make it as class-focused as possible, so I don't know if my ...
6
votes
2answers
73 views

Data-structure exploration

On my quest to learn Ruby I figured exploring the proper usage of different data-structures would be invaluable, including strings, arrays and hashes. I decided to build a hash containing the numbers ...
3
votes
1answer
68 views

Scanning multiple huge files in Python (follow-up)

I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
9
votes
1answer
413 views

Scanning multiple huge files in Python

I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
2
votes
3answers
82 views

File parsing and data management - follow-up

This is part of a two-part post (Part 1). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
3
votes
1answer
34 views

File parsing and data management

This is part of a two-part post (Part 2). Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do. ...
7
votes
1answer
121 views

Finding permutations of a word

This was a basic anagram problem. Take an input word, find all its permutations, then check a dictionary file to see what if any of those are real words. Dictionary file My input data: ...
2
votes
2answers
72 views

Dictionary operations on a Binary Search Tree data structure?

today I tried to code all the dictionary operations such as Search, Successor, Predecessor, Minimum, Maximum, Insert, Delete etc. for a Binary Search Tree data structure using the Java programming ...
8
votes
4answers
585 views

Array implementation of Java Stack

As an exercise, I wanted to make an array implementation of Stack, including most of the methods from the native Java Stack. ...
5
votes
2answers
96 views

Binary Search tree deletion optimization

I have just started implementing Binary Search tree on my own without using any tutorials online. Please have a look and suggest how can I make code less cluttered and more faster. Right now I am ...
7
votes
1answer
85 views

Three-way conversion between Japanese writing systems

When my go-to Japanese transcription site went down for a while, I decided to write my own. My application converts between Romaji, Hiragana and Katakana — however, unlike any other converter ...
2
votes
0answers
213 views

Find maximum distance between two adjacent values in a given array [closed]

The following is code I wrote to solve a codility coding test. This scored 77% on correctness & 50% on performance. I need help in improving it further. Problem statement: Given a ...
1
vote
3answers
98 views

Diffing two lists of business objects

dataListOne and dataListTwo will be full of BO objects (around 4000 - 5000). Lets say ...
3
votes
2answers
47 views

AppVersion Struct & VersionParse Exception

I am working on an app that will interact with assembly (app) versions. I created a struct for that, along with an exception for parsing error. Here's the code: ...
1
vote
1answer
62 views

Coding And Binary Tree implementation C++

When searching for information about the Binary Tree, the code on people's blogs are complicated, so here I'm trying to code a very simple Binary Tree. Am I missing anything? Is there a better way I ...
6
votes
1answer
108 views

Calculate conditional probabilities and perform naive Bayes classification on a given data set

I wrote a class that I'm using to calculate conditional probabilities of a given distribution as well as perform naive Bayes classification. I'd like to get a code review done to tell me if there is ...
4
votes
3answers
40 views

Bad performance of the unsorted list (nearly O(n^2))

I've already made an implementation of Unsorted List but I'm not happy with results it gives. It looks like big-O is nearly n^2 which is, I suppose, not correct for my list. Here's the graph that ...
4
votes
4answers
168 views

Simple singly linked list implementation in C

I have implemented a LinkedList with the ability to add, get elements from a particular position and ability to show all the elements in the array in to the console ...
2
votes
2answers
191 views

Implementing a Linked List in Java

I am studying computer science and decided to implement a linked list from scratch for extra practice. To do so, I created a Node class which simply holds an integer, and wrapped the Nodes in a ...
2
votes
1answer
65 views

Bidirectional map

For fun and to learn a bit, I decided to implement a bidirectional map in Ruby, relying on Ruby core libraries where possible. Its behavior is intended to be that of a Ruby Hash, but one in which ...
1
vote
1answer
25 views

Custom DataGridViewColumn to replace a DataGridViewComboBoxColumn

The issue that i'm trying to fix with this code is simple I have a huge dataset and I have to bind it (as readonly) to a DataGridView In that dataset I have some ...
3
votes
4answers
218 views

Bubble Sort implementation in Java

Below is my implementation of bubble sort in Java. I want to know if there is any other better way to write this algorithm. What other data structures could be used to make it more simple and ...