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)

5
votes
1answer
32 views

Caterpillar uneaten leaves

K caterpillars are eating their way through N leaves, each caterpillar falls from leaf to leaf in a unique sequence, all caterpillars start at a twig at position 0 and falls onto the leaves ...
11
votes
3answers
755 views

Fastest and minimal random access data structure in Java

I have written up a data structure in Java that supports the following features: get(i) set(i, e) ...
-2
votes
0answers
10 views

Tables with same columns in Relational Database [on hold]

I need to know if its a good practice to make tables with the same columns on the database. I have a situation where i have 4 kinds of documents wich each one of them have a correct format (something ...
1
vote
0answers
17 views

Interface for fixed-size container supporting max, min, sum

I had posted this previously as part of Generic container similar supporting PeekMax, PeekMin, Sum, and PeekNextToMax but I think it was to big a morsel for people to chew on. So I'm splitting it up. ...
3
votes
2answers
37 views

Dynamic resizeable array

How can I improve this code for a dynamic and re-sizable array data structure? Array.h ...
6
votes
1answer
58 views

List querying capabilities in Python 3.x

Either out of boredom, or my odd fascination with LINQ and SQL, this, thing, was created. Essentially, it provides list querying capabilities. At the moment, you can only query lists based on ...
2
votes
2answers
46 views

Linked list insertion

I have written the code below for inserting an element at the position specified by the user. I have seen the code in multiple books, and they have always used two pointers in the function that ...
2
votes
2answers
74 views

Maintaining a single collection subdivided by a value's property

I'm working on a networked game. In this game, the base entity is called an actor. An actor can either be replicated or local, with each instance having a "replicates" field that represents this. ...
-1
votes
1answer
39 views

Singly Linked List with Generics and Comparable Data [closed]

I am currently reading about the thread-safe implementation of a linked list. Although I implemented this linked list while keeping in mind the issues from the first code review (Binary Tree). I would ...
5
votes
1answer
48 views

Generic container similar supporting PeekMax, PeekMin, Sum, and PeekNextToMax

I needed to implement a data structure that supports the following operations: create from an existing collection get the maximum item ("Alpha") get the nearest-to-maximum item ("Beta") get the ...
0
votes
1answer
26 views

Implementing quicksort with pivot of first, median or random

I am attempting to implement the quick sort algorithm whereby the pivot will be chosen by the user, and can either be median, first, or random. I am supposed to return a ...
3
votes
2answers
69 views

Add two numbers represented by linked lists

I've just encountered this question and am trying to solve it using Java. Here is my solution to it, which may not be optimized or might not be right way to do it. Someone please review whether it is ...
3
votes
0answers
45 views

Representing trajectory points using inheritance

Problem Background I need to represent trajectory points and trajectories (encapsulating these points) in the form of a collection of classes. All trajectory points have two essential elements: time ...
4
votes
0answers
41 views

F# sudoku game logic

I am trying to create a sudoku game in f# and I'm having a bit of trouble with the file reading and writing. But since I've also just started programming in f# I would like to check if my thinking is ...
1
vote
3answers
230 views

Isomorphic Strings

Two strings are isomorphic if the characters in s can be replaced to get t. Can efficiency be increased further for this code? ...
3
votes
3answers
160 views

Speed up large calculation of intersections

I have the following data: trains is a dictionary with 1700 elements. The keys are the IDs of trains and the value for each train is an array with every station ...
2
votes
1answer
42 views

Linked List Operations in C Read Proof

I am trying to write up all the linked list basic operations (push, pop, add_at_end, pop_from_end, add_at_index, pop_from_index). This is not a school assignment, even though it may look like one. I ...
2
votes
0answers
100 views

A map class based on an AVL tree

Here's an implementation of a class which is similar to std::map, but it's not a complete/identical implementation. I know C pretty well, but am a beginner with ...
12
votes
1answer
123 views

Data item prototype in a Javascript data structure where object instance functions see own data

I'm working on a complex Javascript application which includes its own data structure. The previous version's data structure was rather chaotic, and I'm looking to replace it with something where: ...
4
votes
1answer
89 views

Self Implemented Hash Map Performance

I have written two hash map implementations, one that stores Vertices and one that stores self implemented vectors of Edges. They are all fully functioning, however in my application they are quite ...
1
vote
0answers
20 views

Container with allocator copy assignment

I am trying to write a simple Buffer container class that will behave like std::vector. It should construct only elements that ...
1
vote
1answer
52 views

Graphs processing in Scala

I've just started to learn Scala and decided to implement small graph library to train. Here is the basic version, that describes graph and nodes structure and also provides implementation of ...
6
votes
2answers
151 views

Building in the built-in declarations

In order for Rubberduck to be able to "recognize" the built-in VBA functions, procedures and objects, I added yet another constructor parameter to my Declaration ...
2
votes
2answers
91 views

Better method structure for insertion in doubly linked list

Here is my insertion method for a doubly linked list. It works, but passing two parameters for the method seems cumbersome. Can anyone suggest a cleaner approach than this? ...
0
votes
0answers
30 views

C code to represent a dataset and a 'window' of data

I'm fairly new to C so I'm looking to see if I'm heading in the right direction. This bit of code is to define a structure which represents a dataset (in this case, a GDAL dataset and some ...
3
votes
2answers
103 views

Suffix array construction in \$ O(n \log^2 n) \$

Here is my implementation of the suffix array construction algorithm which follows this paper (specifically, pages 4 and 6). ...
8
votes
3answers
211 views

Suffix tree implementation in Java

I was trying to solve the problem where given a larger string and an array/list of smaller string, we need to make the determination whether the larger string contains each of the smaller strings. I ...
1
vote
1answer
40 views

Minimal Map implementation with weak values

What follows is an implementation of the java.util.Map interface with weak values. This means that entries should be removed from the map when their values become ...
4
votes
1answer
79 views

Simple stack and linked list

I know that Python has a built-in list data structure, but I want to implement my own linked list and stack data structures for practice. I have three classes ...
1
vote
1answer
67 views

Max-heap implementation with List

I am trying to create max-heap for practice. Are there any bugs? Are there ways that I can improve the code quality? ...
12
votes
1answer
164 views

Torus Maze Generator

I have been working on a project to randomly generate a torus made through the use of an adjacency list and disjoint set structure (to be extended to solve the maze later), made from scratch. I think ...
2
votes
2answers
100 views

Find non duplicate Triangle Triplets from a list of given numbers- version 3

It is a continuation of my previous question: Find non duplicateTriangle Triplets from a list of given numbers After I realized triplet structure using less space than ...
2
votes
2answers
119 views

Graph adjacency list implementation in C++

I have been playing around with an adjacency list implementation of a graph class, on which I'd like to be able to run a build and test several graph algorithms. The code I have below works and I have ...
1
vote
2answers
92 views

Array of pointers data structure

Does this data structure make sense? It's essentially a vector of pointers, intended to point to larger objects. In effect, it gives the benefit of a linked list, with an \$O(1)\$ lookup at the cost ...
3
votes
2answers
156 views

Double-ended linked list

I want to know if there is any redundancy in the code or if it is missing something. I ran it with several different choices and it works fine but I still want to know are there any more subtle ...
2
votes
1answer
66 views

Common operations on a linked list (user defined)

I have just started learning data structures and for the past two days I was going through linked lists. I have implemented the basic/common operations on the linked lists and I would love for some ...
1
vote
1answer
54 views

Suffix Array Construction

I'm trying to implement a suffix array for use in programming competitions. I'm using the CodeForces example and trying to "make it my own" so I can make sure I understand it and feel better about ...
5
votes
2answers
791 views

Quack - the revolutionary new data structure

I was having a chat with a friend about data structures (as you do), and that, and his love of portmanteaus meant that he came up with a Quack - A queue and a ...
2
votes
1answer
73 views

Determine the index where two lists diverge

Background A class provides an API to determine the index where two string lists diverge. ...
3
votes
2answers
90 views

Check is_permutation on a pair of same sized arrays

After considering the suggestions of my previous question Check whether given a pair of arrays are permutation of each other, I changed the code. Resolved the bug reported earlier In place of ...
3
votes
3answers
274 views

Check whether given a pair of arrays are permutation of each other

Check whether two given arrays are permutation of each others. Does this implementation guarantee execution of \$O(n)\$ time? What is the additional space utilization for this implementation by ...
2
votes
1answer
106 views

Object pool with linked list of available objects implementation

I was reading some gameprogrammingpatterns (awesome book, by the way, would recommend) and was very excited when I learned that unions are a thing that exists, so I decided to implement an object pool ...
1
vote
0answers
81 views

Create pairs from a set of numbers

Problem here is to list all pairs from a set of integers. We need 2 versions. In the first program, the order matters — pairs (a,b) and (b,a) are considered distinct. In the second program, (a,b) and ...
1
vote
2answers
66 views

Univariate polynomial multiplication using Doubly Linked List

A univariate polynomial is a polynomial over a single variable, and in the following discussion when we say polynomial, we mean a polynomial in a single variable. You are given two polynomials ...
6
votes
2answers
145 views

Simple binary heap in C#

I've written a simple binary heap in C# and I want to know if it has any problems or if I can make it better. ...
10
votes
1answer
1k views

Quadtree implementation

I've implemented a quadtree in C++. Ignore any apparent similarity to the pseudocode on Wikipedia, it's all in your head, I swear. How can I improve? Algorithm speed/space improvements, any extra ...
2
votes
1answer
94 views

Binary Search Tree in C

I have implemented a BST from scratch. My aim is to draft better code and understand some pitfalls which I may have overlooked. It includes the following functionalities: Insert a new item. Find ...
8
votes
1answer
165 views

Java Trie structure

I recently have been working on a Trie in Java. I have looked at the related posts here on Code Review to try and enhance my code, but I do have some methods and constraints not present on other ...
3
votes
2answers
149 views

Constructing and maintaining a complete binary tree

Problem statement: Create and maintain a Complete Binary Tree in C. Include the following operations. Insert a given key and perform inorder Replace ALL occurrences of the given key ...
17
votes
2answers
718 views

Designing another Coffee Machine Application

After reading Designing a coffee machine yesterday, I decided I could also give the same problem a try. I have used the following problem statement (copied from the given question): Design a ...