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.
9
votes
3answers
113 views
Pokemon stats calculator
I have a simple working (so it's not a hypothetical stub) framework for calculating Pokemon stats that will later be incorporated in a game. It uses the LCRNG from the first game in order to be as ...
1
vote
1answer
27 views
Custom OrderedLinkedList class with nested OrderedListNode class
Everything works with this program. It takes both Strings and ints, however, I feel like my add method is simply too verbose. Does anyone believe I can implement a shorter version of this, or is it ...
3
votes
2answers
37 views
SortedList implementation in Java
I've implemented a SortedList which takes in streams of floats and returns a median at any point.
...
0
votes
1answer
39 views
Finding Kth Permutation Sequence
I have written a program to display the kth permutation sequence of a string made up of letters 'O' and 'Z' . I tried optimizing it but my code have not passed test cases due to timeout issues.Looking ...
-4
votes
0answers
22 views
2
votes
0answers
43 views
Uploading .dll files to a local computer
I have created a simple application that has grown a little bit. Though most likely it won't grow anymore, I have looked back and I realized that it has become a little monster in terms of how many ...
0
votes
1answer
35 views
Tree processing for series and parallel execution
I have a tree processing application where some of the nodes are "executed" in parallel and some in series. I managed to do this but I feel that the solution looks a bit "hacked up" and can be ...
4
votes
2answers
78 views
DoublingQueue in Java
Inspired by this CR question, I decided to create my own queue! If you guys see anything taboo or have any improvements, please let me know. Ultimately I want it to be feature rich and bug free, with ...
5
votes
0answers
36 views
Tracking the bounding box of a map
Context
I have a bunch of data points that look roughly like this:
...
3
votes
1answer
43 views
Nesting a flat array in on itself
I have an extremely large function for turning my database output of menu links into a multidimensional array that nests each of the links in a menu fashion. I'm wondering if anyone sees a way this ...
3
votes
0answers
25 views
D trie implementation
I just started to learn D and ported my a bit over-templated trie. It looks way better than on C++.
I'm sure there is still room for improvement and to make it be real D code.
I checked an the array ...
1
vote
2answers
54 views
Finding all root-to-leaf paths in a binary tree
The task is to return all root-to-leaf paths, given a binary tree (from leetcode).
This is my approach.
Take a helper array and a counter, keeping track of what has been traversed so far. If it is ...
1
vote
1answer
71 views
Program to find queue
This is my first time using C++ and Templates to make a data structure I am writing a program to find queue till 5 spaces.
...
4
votes
1answer
51 views
C++ class for disjoint-set/union-find on integers
I have implemented the disjoint-set data structure. The purpose is to group integers together. For example, if I want to find out the groups of integers where each adjacent neighbors are same:
...
2
votes
2answers
84 views
Array-based deque in Java
Are the conditions which I have included for insertion and deletion from front and rear sufficient and necessary? Have I missed some condition check? Or have I included some redundant condition?
...
-2
votes
1answer
52 views
Finding Closest Sibling in a BST efficiently
Trying to print the closest sibling in a BST. How can I improve on this algorithm in terms of space/time efficiency? Please point out any potential bugs too! I'd appreciate that.
...
1
vote
2answers
40 views
Function that assigns names to a struct using strtok
I worked around using strtok function so to assign first name and last name to a struct PERSONNE from a ...
3
votes
1answer
56 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 ...
2
votes
0answers
23 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
71 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
69 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.
...
3
votes
1answer
39 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
64 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
34 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
56 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.
...
3
votes
1answer
64 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
80 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
160 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
129 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
36 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
81 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
70 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
34 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
150 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
136 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
220 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
34 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
74 views
7
votes
1answer
580 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
250 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
46 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
148 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
96 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
75 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
72 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
416 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
85 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
36 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
125 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:
...