The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [linked-list]

A linked list is a data structure in which the elements contain references to the next (and optionally the previous) element.

35 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
73 views

Optimally splitting a text into strings from a set

I am trying to write an algorithm that starts with a corpus of texts (e.g., a Wikipedia dump). It first builds an array of individual characters (e.g., "a", ...
5
votes
3answers
500 views

Organizational Tool GUI with Java Swing (and GridBagLayout)

My first 'large' project is to create an organizational tool. Right now, it's pretty basic, but nevertheless functional in terms of the intent of the current release (v0.3.0). My main question is: '...
4
votes
1answer
100 views

Hashtable implementation in C for generic values

I am trying to implement a hashtable that supports character keys and can return any type of value contained in a struct as long as it contains as long as it contains ...
4
votes
0answers
198 views

Persistent List with constexpr and pointers

I am trying to implement a linked list in C++, functional and persistent. Before looking into sample implementations, I tried to come up with my own as an exercise. I came up with two versions: One ...
3
votes
0answers
44 views

Circular doubly linked list implementation in Cython

This is a follow-up from my previous question. In summary, I am trying to implement a BVH module with Cython and need a way to keep track of the volumes during the construction of the hierarchy. I ...
3
votes
0answers
101 views

Efficient way to fill 2D matrices by rows in a list using R

I have a list of 2D matrices. Each matrix is filled using the function “fillMatrices”. This function adds a number of individuals to each day 0 in a matrix and updates the columns “a_M”, “b_M” and “...
3
votes
0answers
71 views

Sorted LinkedList

A linked list is a data structure that has a beginning, and an end. The only way through the structure is to go to the "next step", like stepping stones. This linked list works the same way, but in ...
3
votes
0answers
58 views

Doubly linked list in Rust using raw pointers

I am practicing Rust by writing doubly linked list using raw pointers, Box<node> to allocate data on heap, Box::from_raw ...
3
votes
0answers
247 views

Linked-list natural merge sort in Python

I implemented the linked-list natural merge sort in Python, and I refered to this awesome if not poetic gist and this implementation in Go. Here is my code: ...
3
votes
0answers
125 views

Linked list with hand-over-hand locking

Follow-up to this question: after reading the comments, I decided to redesign my linked list to have a cursor that only contains one node and implement the interface similar to the one of forward_list ...
3
votes
0answers
109 views

Creating a TSP level with a linked list

I am trying to solve the Travelling Salesman Problem. This function creates the first level in the form of a linked list. This is what the levels look like: This is the code that creates it: ...
3
votes
0answers
311 views

Merge two sorted linked lists in C++

Should I be using std::move or copy when passing LNode in the LinkedList constructor instead ...
2
votes
0answers
15 views

Thread safe Shareable and Splittable Buffer with Safe Memory (Project)

Backstory This is a buffer I wrote for use in multiple personal projects. It is designed to handle pretty much any data in pretty much any way. In particular I intend to use it in such instances as ...
2
votes
0answers
53 views

Faster k-shortest path algorithm in Java

In the \$k\$-shortest path problem, we are searching for (at most) \$k\$ distinct, shortest paths connecting two given terminal nodes. You can see the previous version here. This implementation, ...
2
votes
0answers
520 views

Iterator for custom List class

I have extended a custom list class I have been working on with a Iterator class. I have not used std::iterator as a base class as it will be deprecated in C++17. ...
2
votes
0answers
87 views

Yet Another Linked List

I've been populating my git with some old code, and I came across this linked list I wrote about 10-12 months ago. I'm wondering just how thread safe it is and if there are any improvements I can make ...
2
votes
0answers
39 views

Generalizing work orders

I am working on designing tables for work orders. The problem: There is different work order models (from now on called WOM) The WOMs share some attributes (Num, Date, Description, ... etc) The WOMs ...
2
votes
0answers
162 views

Generic Unrolled Linked List with IList<T> interface implementation

I was inspired by the Phillip Trelford "Beyond Lists" presentation published on InfoQ. So, I decided to make it simple, yet still capable to act as IList<T>. ...
1
vote
0answers
62 views

Merge k Sorted Lists

The task is taken from LeetCode Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Example: ...
1
vote
0answers
38 views

Prompting the user to input a data value into an element in a linked list

I'm working through a practice problem that is having me build and modify a linked list over a series of steps. I am particularly interested in knowing if there's a more elegant way of prompting the ...
1
vote
0answers
59 views

Linked list implementation along with unit test - Round 3

Here are the changes I've made thanks to suggestions made by @vnp, and @Henrik Hansen. Here is the link to the previous code review: Linked list implementation along with unit test - Round 2 I've ...
1
vote
0answers
26 views

The code duplication reducing in the linked list implementation

I am writing the linked list data structure, using this question's requirements (the method set). I have written two working methods, which do the similar thing and differs by only few lines. So, I ...
1
vote
0answers
38 views

(Codewars) Linked Lists - Insert Sort

Kata: https://www.codewars.com/kata/linked-lists-insert-sort/train/python Description Write an InsertSort() function which rearranges nodes in a linked list so they are sorted in increasing ...
1
vote
0answers
53 views

C Generic Sorted Doubly-Linked List

I just finished this big project. Its is called SortedList and it is implemented using a Doubly-Linked List. It data is of type ...
1
vote
0answers
71 views

Speeding up a linked list by using fingers in Java

The idea here is to keep a small number of "fingers" that point to linked list nodes. Now, when, say, the client programmer asks for a node in the list, a closest finger is chosen and is shifted to ...
1
vote
0answers
68 views

selecting 5 best players out of 2 team

Let us assume that we need to develop an application which can select best 11 players to score maximum points. The application will select the best players after completion of a match. The rules are ...
1
vote
0answers
81 views

Transfer values from one LinkedList to another

Write a method transferFrom that accepts a second LinkedIntList as a parameter and that moves values from the second list to this list. You are to attach the ...
1
vote
0answers
168 views

Singly linked list data structure design, implementation and unit testing

Design a singly linked list data structure that supports following operations: size, is_empty, ...
1
vote
0answers
476 views

Direct address hash table

Note: I do know that Python libraries provide better solutions. This implementation has been done to practice python, data structures and Algorithms. This is a implementation of Direct-address hash ...
1
vote
0answers
510 views

A doubly linked list in C++

I'm a Java developer who's learned Cpp ~5 years ago. I'd appreciate any critique on how to make my code more "C++" like. Essentially what I mean by that is I have no idea how to handle memory properly....
1
vote
0answers
2k views

Deque using doubly linked list

I was trying to implement a deque using a singly LL when I realized that eject() (popping the tail element) wasn't going to work without a pointer to the previous ...
1
vote
0answers
112 views

Clone linked structure with random pointer

I've just finished implementing a doubly-linked structure with random pointer and I am trying to see can we do better and would also like to address some lingering questions that I have. Assignment ...
1
vote
0answers
1k views

Breadth-First Search in C: Maze-like use of 2D arrays, linked list

Problem: In a grid of nodes pick a starting node(has mode2), and using Breadth-First search, find one with a ending node (has mode1). You can make walls so it's harder for the search. And that ...
1
vote
0answers
109 views

List interface implementation

After following the comment from greybeard, Below is the design for given first phase of implementation, Code directory structure, ...
1
vote
0answers
223 views

Generic natural merge sort a linked-list in C

I have a .h file that implements my "generic" by defining LINK_* beforehand. This is an implementation of natural merge sort on doubly-linked lists using log n ...