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

learn more… | top users | synonyms

-3
votes
0answers
17 views

Linked List pointer [on hold]

I know this is a simple doubt but can anyone explain me how does this line works? Node* newNode = new Node();
0
votes
1answer
30 views

Delete nodes in linkedlist whose next node is greater

Given a singly linked list, remove all the nodes which have a greater value on right side. Examples: a) The list 12->15->10->11->5->6->2->3->NULL should be changed to ...
1
vote
1answer
28 views

Find union and intersection of linked list

Find the union and intersection of linked list, given that elements don't repeat in a single linked list. This question is attributed to GeeksForGeeks. Looking for code-review, optimizations ...
0
votes
0answers
20 views

Convert a doubly linked list into balanced binary search tree in-place

Given a doubly linked list which has data members sorted in ascending order, construct a balanced binary search tree which has same data members as the given doubly linked list. The tree must ...
4
votes
3answers
146 views

Dictionary load function using hash table

This loads a dictionary text file into memory to be used as part of a spell checker. It's part of a larger program, but I wanted general comments so I can clean it up further. ...
6
votes
2answers
81 views

Flatten a multilevel linked list

Given such a structure the output should be ...
0
votes
1answer
54 views

Add two numbers represented by linkedlist

Given two numbers represented by two linked lists, write a function that returns sum list. The sum list is linked list representation of addition of two input numbers. It is not allowed to modify the ...
3
votes
1answer
39 views

Simplifying linked list “search and delete” function

The function asks the user for a value to search for, then deletes all matching values in the list. The program runs flawlessly, but I can't figure out a simple/elegant way of separating cases for ...
1
vote
0answers
26 views

Following-up “given a two dimensional linked list, create a flattened sorted list”

A node has a next and down pointer. Merge the linked-list such that end result is sorted. Here we have a top level linked-list, followed by a down-list. If { 10 : {20, 30} , 35 { 40, 50 } ...
2
votes
0answers
29 views

Deleting nodes having greater value on right side

Problem Summary: Given a singly linked list, remove all the nodes which have a greater value on right side. Example: The list 12->15->10->11->5->6->2->3->NULL should be changed to 15->11->6->3->NULL. ...
6
votes
1answer
82 views

Merge two linked list

Given two linkedlist, merge them. Looking for code review, optimizations and best practices. The code is influenced by feedback here. Changes incorporated were: Linkedlist is no-longer write-only ...
0
votes
1answer
33 views

Implementing a bubble sort on a linked list [closed]

I'm using the following prototype: Data* bubble_sort(Data *list); I'm trying to implement a bubble sort given a linked list of names. Note: this returns ...
0
votes
3answers
120 views

Given a two dimensional linked list, create a flattened sorted list

A node has a next and down pointer. Merge the linked-list such that end result is sorted. Here we have a top level linked-list, followed by a down-list. If { 10 : {20, 30} , 35 { 40, 50 } } is the ...
4
votes
3answers
134 views

Repeatedly skip M nodes then delete N nodes then skip M nodes and so on

Given a linked list and two integers M and N. Traverse the linked list such that you retain M nodes then delete next N nodes, continue the same until end of the linked list. Input: ...
1
vote
1answer
57 views

Sort a linkedlist with 3 elements 0, 1 and 2

Given a linked list of 0s, 1s and 2s, sort it. Looking for code review, optimizations and best practices ...
8
votes
3answers
685 views

Doubly-Linked Circular Linked List

I'm a C++ programmer learning Java in preparation for an OOP class this fall. That being said, Java is fairly new to me so I'd love to hear feedback on how to improve this code. A few notes: Code ...
5
votes
3answers
132 views

Linked list with iterators

This is my second linked list implementation for review. I rewritten pretty much all of this and have added iterators, sentinels and The Rule of Five. Please let me know what's wrong with it; I am ...
1
vote
2answers
71 views

Reverse a doubly linkedlist

Reverse a doubly linkedlist. Looking for code review, optimizations and best practices. ...
11
votes
3answers
548 views

Linked list implementation correctness

I've started learning C++ and I wanted to ask you to take a look at my linked list implementation and give comments what's wrong with. It compiles and runs fine, but I am curious about const ...
4
votes
2answers
93 views

Implement queue using linkedlist

Implement queue using linkedlist. Looking for code review, optimizations and best practices. ...
4
votes
1answer
38 views

Implement stack using a linked list

I am trying to implement Stack using a linked list. Looking for code-review, best practices and optimizations. ...
6
votes
1answer
71 views

Flatten double-linked list

Consider this interview question: Given a Node with a reference to a child, its next, its previous, and a variable for its value (\$\frac{1}{2}\$ tree, \$\frac{1}{2}\$ doubly linked list ...
10
votes
1answer
156 views

Tweets per second, using linked list

This is a TalentBuddy Challenge Your task is to write a function that prints to the standard output (stdout) the highest number of tweets recorded between each second in the array and the past ...
12
votes
6answers
2k views

Implementing a Stack in Java for Technical Interview

This code is based off the Stack implementation in Chapter 3 of Cracking The Coding Interview. I modified the code to make it compile and give me the correct output. I'd appreciate any feedback on ...
2
votes
1answer
35 views

v2 - Adding a duplicate entry randomly into a list in haskell using random monad

Next version of Adding a duplicate entry randomly into a list in haskell using random monad I wrote this trying to set up a Haskell testcase. The aim is to take a list and add a single duplicate from ...
2
votes
2answers
100 views

Pointers for struct and `for`

I know something about pointers, but I'm trying to check my knowledge on a sample. Can somebody check if my code is good? I don't think that I should use pointers in these ...
1
vote
1answer
110 views

Convert sorted linkedlist into balanced binary search tree

Convert a sorted linkedlist into a balanced binary search tree. Looking for code-review, optimizations, and best practices. ...
3
votes
1answer
90 views

Lock-free queue with doubly linked list correctness

I need a lock-free queue which is implemented by doubly linked list. Is my code correct? Are there any errors? Are there any improvements to be made? linkedlist.h ...
10
votes
3answers
107 views

Dynamic library to intercept oddsock hostname lookups

Just for the fun of it, I decided I would try to create sort of an intermediate DNS system for the oddsock SOCKS proxy. With this, the domain name extension .unet is statically resolved when ...
4
votes
2answers
77 views

Reverse sublists of a linked list

This code reverses each consecutive n elements of a linked list, and for spare nodes, leaves them as they are. For example, the linked list 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 for an interval of 3 ...
2
votes
1answer
60 views

Swapping adjacent nodes of a linked list

I just have a small question. The code I wrote works well for the problem. But is it the best way, or can we make it better? ...
5
votes
5answers
461 views

Implementing a set using a linked list

My task is to add the specified element to the linked list if it is not already present ...
2
votes
1answer
44 views

Implementation of the undef function

Write a function undef that will remove a name and a definition from the maintained by lookup and ...
10
votes
3answers
565 views

LinkedList implementation implementing the List interface in Java

So here it is, my linked-list implementation in Java. I have coded against Java's List<E> interface as if my ...
10
votes
1answer
494 views

Bubble Sort in C: Array vs Linked List

A few weeks ago I posted a code review of a linked list so I decided to implement bubble sort on my journey of learning C. Here is the referenced linked list library, though this isn't really what's ...
4
votes
2answers
275 views

Singly linked list implementation

I feel like there is room for improvement in the push/pop methods. Any suggestions? ...
4
votes
2answers
134 views

3-class linked list

I am trying to make a linked list using 3 classes, however I cannot find ANY information online about it, and I can't seem to figure it out myself. If you could please correct and explain what I am ...
7
votes
1answer
114 views

Linked List reversal

Recursive version. The only interesting function: The original version: ...
19
votes
1answer
317 views

Stack implemented using linked list in x86_64 assembly

I wrote a stack implementation using a singly linked list in x86_64 assembly. This stack supports the usual push/pop operations ...
11
votes
1answer
237 views

Linux NASM assembly linked list implementation

Inspired by all of the lovely linked lists lately, I decided to implement one in assembly language. This code maintains two linked lists - one is a free store and the other is the active linked list. ...
5
votes
3answers
346 views

Singly-linked grocery list

For my own linked list implementation, I've decided to try something different: a linked list of groceries. The main differences between this implementation and a standard list are: more data ...
4
votes
1answer
117 views

Passing Node objects into insert routine of linked list

I've created a linked list class in Python, but I'm not sure how to enforce only passing Node objects into the insert routine. ...
10
votes
6answers
692 views

In-place reversal of a singly linked list

As suggested in The 2nd Monitor, I'd like a review of this in-place reversal of a singly linked-list: ...
4
votes
5answers
355 views

Validating that all open/close parentheses are correctly matched

It returns true for: a*(b+c) ()() (()) ((!!(123(x)))) and returns false for: ...
4
votes
1answer
81 views

Creating a list using a struct in C

I just got into structs and I decided to create a list using them: ...
10
votes
3answers
195 views

Simple Linked List

I've implemented a simple linked list in C# using generic T for values. I did not inherit from any of .Net's fun and helpful classes like ...
5
votes
3answers
192 views

Adding two BigIntegers by putting mutiple digits in a linked list

Based on feedback on an earlier question, I decided to implement the addition of two big ints by putting multiple digits in a node of a linked list. Can somebody take a look at my code and let me know ...
1
vote
1answer
281 views

Even and odd numbers in linked list [closed]

I have a linked list that stores integers. I must split the linked list into two linked list, one stores the even numbers and the other store the odd numbers. When I compile, it prints just the ...
5
votes
2answers
243 views

Adding two BigInts using linked lists in C

While trying to learn more about linked lists, I thought I should try the exercise of reading two BigInts from an input file and then adding them up. My strategy was to store the two numbers in two ...