Skip to main content

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.

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5 votes
0 answers
88 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", ...
wizplum's user avatar
  • 151
4 votes
0 answers
300 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 ...
Jeacom's user avatar
  • 125
4 votes
0 answers
111 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 ...
KGlasier's user avatar
  • 141
4 votes
0 answers
932 views

Linked-list natural merge sort in Python

I implemented the linked-list natural merge sort in Python, and I referred to this awesome if not poetic gist and this implementation in Go. Here is my code: ...
Lerner Zhang's user avatar
4 votes
0 answers
536 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 ...
meguli's user avatar
  • 215
3 votes
0 answers
306 views

How can I filter and sort LinkedList faster and more effective?I have list of orders that should be processed

I have method that fetches all orders from Database and filtering, sorting that data(I know better to do It by specific query to Database but I dont know how). I have Order entity that has following <...
Justtoasktheneededquestions's user avatar
3 votes
0 answers
120 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 “...
Pierre's user avatar
  • 163
3 votes
0 answers
1k 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 ...
nhtrnm's user avatar
  • 183
3 votes
0 answers
378 views

Merge two sorted linked lists in C++

Should I be using std::move or copy when passing LNode in the LinkedList constructor instead ...
user1044328's user avatar
2 votes
0 answers
44 views

Grading script in SCALA

The prompt is as follows: This script will use a text menu to give the user options. The options will include the ability to add grades of different types as well as an option to print the current ...
Asjal Ahmad's user avatar
2 votes
0 answers
268 views

Async linked list to and from async iterable

I'm working on some stuff that works better with (immutable async) linked lists such as this: ...
Juan's user avatar
  • 655
2 votes
0 answers
53 views

Linkedlist & hashmap _duplicates removal

I have implemented a LinkedList removal fo duplicates class by using HashMap. Looking forward to your reviews. Thanks. ...
Neslihan Bozer's user avatar
2 votes
0 answers
27 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 ...
LambdaBeta's user avatar
2 votes
0 answers
151 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, ...
coderodde's user avatar
  • 28.7k
2 votes
0 answers
123 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 ...
Goodies's user avatar
  • 129
2 votes
0 answers
44 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 ...
Ismail's user avatar
  • 121
2 votes
0 answers
201 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>. ...
GKalnytskyi's user avatar
1 vote
0 answers
191 views

Delete a linked list using recursion in Python

Given a Singly Linked-List, write a function to delete the linked list recursively. Below is my attempt. I am confused if I should use del keyword to delete the nodes or below method is better. I don'...
cugu's user avatar
  • 11
1 vote
0 answers
46 views

Implementing Doubly Linked List in Python

My take on Doubly Linked List in Python. Is there a more efficient and compact way to do this? Are there any bugs in my program if so how can i fix it? PS: I'm a beginner in Object Oriented ...
Anonymous's user avatar
  • 1,224
1 vote
0 answers
1k 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 ...
Octavius's user avatar
1 vote
0 answers
87 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 ...
Tobi Alafin's user avatar
  • 1,796
1 vote
0 answers
90 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 ...
ss321c's user avatar
  • 19
1 vote
0 answers
1k 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. ...
SRG's user avatar
  • 405
1 vote
0 answers
2k 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 ...
Lazar Todorović's user avatar