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
43 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
31 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
21 views

implementing a StringEnum

this is to be used like an Enum (as parameter mostly), but for string using .net 3.5 Actual Implementation ...
3
votes
1answer
50 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
39 views

Flatten a nested dict structure in Python

For some post-processing, I need to flatten a structure like this ...
0
votes
0answers
24 views

'Map' datastructure Psuedo-Code [closed]

I'm making my own programming language called Jazz and are currently implementing the stdlib. I'm working on util.map at the ...
2
votes
1answer
34 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
74 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 ...
-2
votes
0answers
51 views

Can anybody help me with this (graph theory)?

I am preparing for job interviews and learning Analysis and design of algorithms. I have solved many problems using dynamic programming and greedy methods, but I am struck with this problem and unable ...
1
vote
4answers
311 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 ...
4
votes
1answer
153 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
33 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
60 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
81 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 ...
5
votes
1answer
73 views

Write a program that, given an age in seconds, calculates how old someone is in terms of a given planet's solar years

Problem: Write a program that, given an age in seconds, calculates how old someone is in terms of a given planet's solar years. Earth: orbital period 365.25 Earth days, or 31557600 ...
1
vote
1answer
53 views

Reverse a linked list recursively

This recursive calls reverseList on each node of the linked list. When returned from the function call, it changes the next link to the previous node. ...
0
votes
0answers
15 views

Flattened Data Model and noSQL data structure

I am currently building a small application using a service which requires and advocates the use of a "flattened" data model (the service is Firebase). As I had no experience with data models before, ...
4
votes
0answers
36 views

No-copy cache line aligned function storage object with small object optimization

I have implemented a std::function-like class, that is optimized for storing lambdas, that never copies the stored function, that has a small buffer to store ...
3
votes
1answer
65 views

Write a small archiving program that stores students' names along with the grade that they are in

Problem: Write a small archiving program that stores students' names along with the grade that they are in. In the end, you should be able to: Add a student's name to the roster for ...
4
votes
2answers
83 views

Let me fix thou number

Problem Statement: Write a program that cleans up user-entered phone numbers so that they can be sent SMS messages. The rules are as follows: If the phone number is less than 10 ...
4
votes
1answer
43 views

Transparent wrapper class for data structure in Python

I needed a deque who's maxlen can be set again after it has been initialized. So, since new-style classes in Python are treated ...
-3
votes
1answer
42 views

Creating a struct

Mat told me to create a struct create a struct for the individual commands and arguments. It should have something like the "executable" name, number of args and arg list. Create a few ...
5
votes
1answer
52 views

Let's have a meetup

Problem statement: Calculate the date of meetups. Typically meetups happen on the same day of the week. Examples are the first Monday the third Tuesday the Wednesteenth the ...
3
votes
2answers
102 views

FindTwoSums using Tuple

I am writing a function that, given a list and a target sum, returns zero-based indices of any two distinct elements whose sum is equal to the target sum. If there are no such elements, the function ...
0
votes
1answer
24 views

C function for copying array into matrix

I want a matrix that can grow dynamically and build up a structure in RAM as input arrives from standard input och terminal (shell). First I tried with a matrix like ...
16
votes
5answers
1k views

Generating Robot Name

Problem: Write a program that manages robot factory settings. When robots come off the factory floor, they have no name. The first time you boot them up, a random name is generated, such ...
1
vote
0answers
36 views

Union Find implementation

I am trying to complete this challenge. The user should enter a sequence of instructions, = to link two numbers, and ? to query ...
3
votes
3answers
93 views

Calculate the Hamming difference between two DNA strands

Write a program that can calculate the Hamming difference between two DNA strands. GAGCCTACTAACGGGAT CATCGTAATGACGGCCT ^ ^ ^ ^ ^ ^^ The Hamming distance between these two ...
2
votes
0answers
36 views

Concurrent resizable ring buffer Golang

I'm trying to find the fastest way to enqueue and dequeue items concurrently in Go. There are some restrictions: it needs to be unbounded memory allocation should be low. multiple producers ...
1
vote
0answers
44 views

Binary search tree class in Java

I am trying to create a binary search tree class in Java and am wondering how I did. I am fairly confident on most of the methods, but fear I may have messed up the delete method. I know I am ...
1
vote
0answers
34 views

A stack optimized for filter queries, written in C++ preprocessor

Given a stack with N elements and a query Q we need to find all elements of stack, for which ...
7
votes
3answers
202 views

Nucleotide Count

I am learning Java and hence practicing it from here. The solution seems pretty trivial to me but still I would like to have a honest review which would guide me to following ideas: Am I maintaining ...
4
votes
1answer
83 views

Implementing Binary Tree using Queue in C#

I am in the process of learning data structures and I am trying to implement Binary Tree using Queue in C#. Below are my Tree implementation classes. ...
0
votes
2answers
51 views
4
votes
1answer
115 views

VERY simple C# Set implementation

This is not meant to solve any insane real world problems. I just want to make sure my Set logic is right and the code looks okay. It feels weird implementing it with a ...
9
votes
3answers
1k views

Simple C# HashTable Implementation

Haven't put one of these together since college. How does this look overall? ...
1
vote
1answer
30 views

Assigning neighbor in a binary tree

This code is to solve the problem as mentioned here: ...
5
votes
1answer
127 views

My first implementation of a linked list in C++

This is my very first implementation of a full-fledged ADT, which could potentially be use-ready. Now, I'm still learning, therefore I would like to ask you what I can do to further improve the ...
0
votes
1answer
83 views

Custom Dynamic Array

Pretty simple class but just want to make sure I've approached it correctly. ...
2
votes
1answer
60 views

Dynamic array stack and bag implementation

I've have methods for a stack and bag using a dynamic array in C. As far as I can tell everything is implemented correctly, but I'm wondering what I can do to improve this code. dynArray.h ...
0
votes
1answer
39 views

Detecting cycle in LinkedList

Is this a fair/clean way to detect a cycle in a LinkedList? Should work for both single and double LinkedLists'. ...
0
votes
1answer
26 views

Generic LinkedList with add/exists/delete/dlear/iteration functionality

I've just been going through core data structures and algorithms recently, wanting to get back in touch with the core fundamentals. I'm starting simple with a ...
-1
votes
1answer
20 views

Singly linked list abstraction in ES5 JavaScript

Below is the code for, Singly linked list implementation, ...
-2
votes
1answer
99 views

3 exams, 20 students: calculating the per-student average score [closed]

I'm a little curious... I have to work on a program in which a student takes 3 exams and the average is taken from the 3 exams that a student takes. It then goes into a form of a table, where one ...
2
votes
2answers
74 views

A linked list with push pop append and destructor

I tried to implement a linked list that can do pop(), push(), append(), printall(), and so on, and also I tried to handle the wraparound features, and de-wrap it when check if the list is cyclic to ...
2
votes
2answers
121 views

C++ Generic Linked List

My goal is to write a reasonably robust c++ linked list class. The current code represents the latest phase in this attempt. My future goal is to implement a doubly linked list along with more member ...
2
votes
0answers
40 views

Union-find implementation

Here are a few questions on my mind: What improvements to the above code can you think of? I want to say new UnionFind(x) where ...
4
votes
1answer
70 views

Evicting an entry from a size-limited HashMap<T, Integer>

I have a HashMap with a limited size of 1000 elements. When I want to put one more, the T with the lowest related Integer in the map should be replaced with the new one. I already have this working ...
0
votes
0answers
34 views

Using actors to collect paged data structures exposed through REST API

I've come up with a small exercise to learn scala consisting of making a client that assembles a graph available as a resource. The API server responds with a paged list of edges, in the form of ...
0
votes
1answer
61 views

Simple weighted directed graph in Python

I have this simplistic Python class for representing directed weighted graphs (digraphs for short): Digraph.py ...