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

1,040 questions
Filter by
Sorted by
Tagged with
2k views

Recently, a company has asked me to make an implementation of a doubly linked list with unity tests to test my skills. In the task description they specified that the solution should be as academic as ...
• 233
198 views

### Convert a Binary Tree to Doubly Linked List

Challenge Link on geeksforgeeks: Binary Tree to DLL Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as previous ...
• 13.8k
511 views

### LinkedList using Node Class in C++

I implemented Linked List data structure in C++ for practice purpose. The LinkedList.h uses Node.h as nodes. Creates and insert ...
• 236
584 views

### Rotate List by K places

I am trying to solve the question at :https://leetcode.com/problems/rotate-list/ Question: Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1:...
• 109
1k views

### LeetCode #37: Sudoku as Exact Cover Problem solved using Dancing Links

Introduction I provide a regular 9x9 Sudoku solver, reducing the puzzle to an Exact Cover Problem. The algorithm used is Knuth'...
• 13.8k
336 views

Linked List Implementation in Swift Swift 5.0, Xcode 10.3 I have written an implementation for a doubly linked list in Swift. As well, I decided to make the node class private and thus hidden to the ...
• 271
298 views

Challenge https://leetcode.com/explore/interview/card/top-interview-questions-easy/93/linked-list/773/ Given a linked list, determine if it has a cycle in it. To represent a cycle in the ...
• 5,331
1 vote
55 views

### Remove Duplicates From Linked List In Place - Java [closed]

This is my implementation ...
• 1,555
238 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 ...
• 125
101 views

### Implementation of a Singularly LinkedList

I'm new to C++ and trying to learn by implementing data structures in it. Is the code below the most efficient way of implementing the data structure in C++? Does it conform to C++ standards, and how ...
• 129
100 views

### Doubly linked list in Cython

I am implementing a BVH (Bounding volume hierarchy) in Cython and thought of using a doubly linked list to hold reference of the volumes that still need to be split and push new volumes at one end ...
• 125
150 views

### C++ singly linked list with iterator

I have written a simple singly linked list in C++. I have previously had a data structure in an interview criticised for being too C-like (no iterators and using new/delete) instead of smart pointers. ...
1 vote
76 views

### Insert new middleware at the "right" location

I need to have my logger middlewares (nodes of a linked-list) in the right order so that they complement each other and work as desired. Any known middleware can be inserted anytime but the first and ...
• 43.8k
235 views

### Logger adapter with a configurable chain of responsibility of middlewares

I use my own logger adapter that collects data into a dictionary: public class Log : Dictionary<string, object> { } This is really all I have. I then pass ...
• 43.8k
1 vote
62 views

### Reverse a Linked List in place

I am solving some programming challenges for learning Javascript. The challenge I chose is: Given the head of a singly linked list, reverse it in-place. Here is my implementation in JS ...
• 1,555
76 views

A follow up for this question: Implementing Linked lists in Python from scratch Node: ...
• 303
2k views

### Very basic singly linked list

Here is implementation for singly linkedlist. Any suggestions are most welcome ...
• 169
113 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 “...
• 163
255 views

### Implementing Linked lists in Python from scratch

After finishing my ds and algorithms course I wanted to implement what I've learned through the semester so here is my try for Linked lists, both regular (one way) and double one (two way). code: <...
• 303
185 views

### Adding a Node to the Linked List is taking a longer Time when using a reference to the Tail Node

I am trying to add two numbers in the form of linked List and return their result in a Linked List as given in https://leetcode.com/problems/add-two-numbers/ Question: You are given two non-empty ...
• 109
109 views

### c++14 move constructor and assignment in simple list

I’m moving from c98 to c++14 and I’m trying to figure out how to write move correctly. I just wrote the simplest list with no functionality, just testing the construction and copy behavior. I would ...
1k views

### Singly Linkedlist implementation in C++

I'm implementing a linkedlist in C++ with the essential functionalities. I would like to know what is good in this code and what is bad. In terms of everything (memory usage, functions ...
• 175
303 views

### Generic data structures in C

I'm new to C, and I thought a great way to learn would be to implement some generic data structures and algorithms. So far I've implemented a linked list and a dynamic array. Both are generic, the ...
• 91
102 views

### First attempt at making linkedlist in c

I started learning c and wanted to challenge myself by making a linked list. I am stil new to the concept of pointers and pointers to pointers, so there might be something in my code that I could have ...
896 views

I solved a problem with JavaScript which has the following requirements: Two non-empty linked lists representing two non-negative integers. Digits stored in reverse order Each node contains a single ...
• 203
23 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 ...
• 131
588 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 ...
• 220
1 vote
222 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: ...
• 3,953
123 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, ...
• 26k
999 views

### C++ Implementation of Linked List

I have been trying to teach myself C++ recently and would like to have some general feedback and comments on how to improve my code so far. Furthermore, since I am more experienced with other (garbage-...
225 views

I have attempted to make a class similar to vectors in c++ (Though, I now know that it's just a (doubly) linked list). Just wanna know, how good or efficient my program is, how well I am as a ...
• 131
153 views

### Simple linked list with two iterators

As part of the practice, I created minimalist linked list named SimpleList which can be iterated in two different ways: one element after another or by every second ...
• 59
107 views

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 ...
• 161
55 views

### Singly-linked queue in PHP 7 #2

I have improved this post to the code below. As always, any critique is much appreciated! ...
• 26k
43 views

### Singly-linked queue in PHP 7

I am learning PHP 7 and decided to implement a simple FIFO singly-linked queue in it: ...
• 26k
439 views

I am still learning Rust and I think I have a long way to go. This question is from exercism.io. I am posting here to get some more reviews and suggestions to improve my code. Linked list aren't a ...
• 151
1 vote
52 views

### Linked list delete a node with a particular value [closed]

I am trying to search a single linked list with a particular value and delete it. Only the first occurrence of the value. ...
• 351
195 views

### Leetcode: Flatten binary tree to linked list C#

https://leetcode.com/problems/flatten-binary-tree-to-linked-list/ Please comment on performance Given a binary tree, flatten it to a linked list in-place. For example, given the following ...
• 5,331
174 views

I have some imminent interviews and want to sharpen my game before going into them. I'm running through some practice problems. This LeetCode challenge is to add two numbers represented as linked ...
• 193
158 views

### First C program: records keyboard/mouse and simulates the recording afterwards

This is my first program ever made in C. Before that I programmed just a little bit in C++ (didn't touch OOP so I did only structural programming). This is my second "project" ever made, the first "...
• 209
94 views

### (Ruby version) Rotate linked list to the right by k places

I saw this question (javascript - rotate linked list to the right by k places) the other day and I tried implementing it in Ruby in a totally different way. Here's the code (I also created a REPL if ...
• 217
599 views

### Rotate a linked list to the right by k places

The task Given a linked list and a positive integer k, rotate the list to the right by k places. For example, given the linked list 7 -> 7 -> 3 -> 5 and k = 2, it should become 3 -> 5 -> 7 ...
• 3,953
129 views

### Graph implementation using FIFO lists

I've made a little implementation of an undirected graph, using FIFO lists, for one of my homeworks. Never really knew how to write a proper FIFO data structure, so I would be glad to see some opinion ...
1 vote
60 views

### TLE error: Remove element from LinkedList [closed]

I am working on an easy LinkedList basic operation problem on Remove Linked List Elements - LeetCode Remove Linked List Elements Remove all elements from a linked list of integers that ...
• 603
1 vote
953 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 ...
• 51
150 views

### Single-Linked List in C - beginner

I'm a python dev by day trying to learn C. This is a simple implementation of a singly linked list. As a noob I would like comments on style and C conventions as well as functional remarks on memory ...
• 359
568 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 ...
1k views

### Generic Macro Generated Linked List in C

Generate a linked list of any type using macros. The linked list contains functions for adding and removing elements to both ends and also at the middle. You can also add elements relatively to a list ...
• 347