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

6
votes
2answers
66 views

Flatten a multilevel linked list

Given such a structure the output should be ...
0
votes
0answers
27 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
36 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
22 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
26 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
80 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
117 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
676 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
129 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
70 views

Reverse a doubly linkedlist

Reverse a doubly linkedlist. Looking for code review, optimizations and best practices. ...
11
votes
3answers
545 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
91 views

Implement queue using linkedlist

Implement queue using linkedlist. Looking for code review, optimizations and best practices. ...
4
votes
1answer
37 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
68 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
147 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
33 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
99 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
95 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
86 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
76 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
59 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
459 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
43 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
518 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
474 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
266 views

Singly linked list implementation

I feel like there is room for improvement in the push/pop methods. Any suggestions? ...
4
votes
2answers
133 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
113 views

Linked List reversal

Recursive version. The only interesting function: The original version: ...
19
votes
1answer
313 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
228 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
345 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
115 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
674 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
336 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
79 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
193 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
191 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
268 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
236 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 ...
5
votes
1answer
106 views

Linked List implementation and manipulations in C

While trying to learn some more C, I decided to implement a linked list and perform a few operations on it. The first thing I wanted to do was read from a .csv of numbers (ex: 1,2,3,...) and store ...
6
votes
4answers
488 views
6
votes
2answers
169 views

STL-compliant list class

Well, this is my first attempt to create a STL-compliant container. I'd like to know whether it meets STL concepts & requirements, so feel free to critique. .h link - ...
4
votes
4answers
652 views

Make LinkedList in C++ more clean

I have been working on a linked list for some while now and started out with this. Is my code clean? Or is there some way to make it better and more readable? The reason for this question is for me ...
12
votes
3answers
353 views

Reversing k-sized sequences in a linked-list

Here is my solution to this problem; please be brutally honest/strict, if I would have written this code, in a 45 minute interview, what would you think? (I am aiming for Google,Facebook). Here is ...