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

1
vote
1answer
27 views

Linked object for creating chains without lists

I need a LinkedList but unfortunatelly the one that the .NET provides didn't have the functionality I was looking for (not working with linq and the LinkedListNode ...
2
votes
0answers
29 views

Implementation of disjoint set in Java with linked-list

I have just wrote a linked list implementation of disjoint sets in Java for the Rainfall Problem. Can you take a look and tell me if there is something missing and also make a judgement in ...
-1
votes
1answer
97 views

Simplest linked list in C++?

My context was basically to get my linked list implementation in C++ reviewed, since I wrote it from scratch and wanted to make it as simple as possible and learn from suggestions I get. I am trying ...
4
votes
1answer
33 views

A Generic Approach To Doubly Linked Lists

I've written a small implementation for doubly linked lists. While actually intended to be only used by me in subsequent projects, I wrote it as generically as possible. Maybe this'll be advantageous. ...
3
votes
1answer
56 views

Quick-sort a linked list?

I have a little project where i am implementing an immutable linked-list (not only...) based on a pair-structure like the LISP cons-cell. The linked list works well and is basically wrapping two ...
1
vote
1answer
52 views

Templated linked list in Java

I recently reviewed some data structure concepts, so I implemented my own templated linked list. I am very interested about the code efficient and performance. ...
2
votes
1answer
48 views

AVL tree implementation in Python

Is my implementation of AVL tree correct? It is my second Python program and I am not sure if do code properly. ...
6
votes
2answers
79 views

Linked list for interviews

I'm trying to learn linked lists so I can answer interview questions. Even though I've seen plenty of tutorials to understand how they supposedly work, I don't know if I am doing a good job because I ...
4
votes
1answer
47 views

Singly-linked implementation in C

I'm a C++ programmer and thought I'd revisit the roots, so I scribbled something really quickly. I would appreciate input on how my C code is looking! slist.h ...
3
votes
1answer
42 views

Singly linked list in pure C - follow-up

This is an update for this post. I fixed all style-issues from the comments, but still have a few questions left: Someone commented that my last post contained too many functions, which could be ...
2
votes
3answers
56 views

Singly Linked List in pure C

I recently learned about linked lists and here is my first try to write one in C. I know it's a lot of code, but I hope someone takes a look. Any tips memory allocation and improvements are welcome. ...
3
votes
2answers
60 views

Removing duplicates from a linked list without a buffer

I am practicing a problem in "Cracking the Coding Interview". The problem is to remove duplicates in a linked list without the use of a buffer. I interpreted this as not using a list or any large data ...
0
votes
1answer
21 views

LinkedListy-Stack

I came across this interesting question while reading 'Cracking the coding Interview' and came up with a simple implementation. Any suggestions are welcomed. Imagine a (literal) stack of plates. ...
4
votes
2answers
54 views

Dictionary implementation using hash table in C

I have written the below code which loads the dictionary and checks if the given word is present or not. The implementation is using a hash table with a chained linked list. In regards to the hash ...
3
votes
2answers
77 views

C++ Stack implementation using std::list

I have the following 'interface' to the C++ std::list and I was wondering how I could make it go faster. In particular, it needs to be able to evaluate up to two ...
1
vote
2answers
68 views

Check if a linked list is a palindrome in O(n) time and O(1) space

I liked this problem because there are so many sub-problems that are interview problems in their own right-- (reverse linked list, find midpoint) ...
3
votes
2answers
108 views

HashMap or associative arrays in C

I am trying to implement an HashMap in C. I am trying to used a linked list style of interfacing to make adding and removing keys easy and efficient. Searching is ...
5
votes
2answers
68 views

Remove duplicates from unsorted linked list

Remove duplicate elements from linked list. ...
5
votes
2answers
243 views

Linked list in C

I'm trying to get into C, and I was wondering if I messed up regarding correctly implementing a linked list. node.h ...
5
votes
1answer
64 views

Node, Link, Node, Link, Node: Linking Nodes into a LinkedList

For practice in Python OOP (first time) and for some relaxation from trying to learn Serialization in Java, I decided to write a LinkedList in Python. Now, this class would be pretty useless, because ...
7
votes
3answers
309 views

Singly Linked List implementation in Java

Here's my implementation of a Singly Linked List. Would appreciate a review. ...
10
votes
3answers
339 views

Python linked list

This is my first attempt at making a singly linked-list class. Would this sort of implementation be sufficient for interviewing quality? ...
5
votes
4answers
128 views

Merge two sorted linked lists without recursion

Is this an effective way for merging two lists? It seemed too long. struct Node { int item; Node *next; }; Method: ...
2
votes
2answers
61 views

Merge two linked lists in Python

I have a method which will merger two sorted list together. The function works, but I saw some duplicated code. Any ideas to make the code more elegant? ...
4
votes
1answer
57 views

Singly linked list delete() method

I would like a quick review on my method to delete a node from a singly linked list. I'm fairly certain that this is not near optimally done, and would love to get feedback. It uses a ...
3
votes
2answers
91 views

Singly-linked list implementation with iterators

Taking into account everything you guys told me last time I posted, I came up with this implementation of a singly-linked list, in which the first and last elements are known. I tried to make the ...
4
votes
2answers
120 views

Does my Linklist implementation have memory leaks?

Are there any memory leaks in this linklist implementation.Also is the implementation correct?Can the time complexity be optimized? ...
3
votes
1answer
74 views

ARP implementation

I am a beginner in C and wrote this code to implement ARP. 3 threads are present - one to respond/receive any ARP packet targeted to me, one to refresh the ARP table on a periodic basis, and one to ...
3
votes
1answer
82 views

Singly Linked List in C++

I've written a singly linked list in C++. Would appreciate reviews on code efficiency and best practices. ...
5
votes
2answers
247 views

Stack implemented using a single linked list

I am studying data structures and I have implemented a stack using a linked list. stack.h ...
4
votes
4answers
168 views

Simple singly linked list implementation in C

I have implemented a LinkedList with the ability to add, get elements from a particular position and ability to show all the elements in the array in to the console ...
2
votes
2answers
191 views

Implementing a Linked List in Java

I am studying computer science and decided to implement a linked list from scratch for extra practice. To do so, I created a Node class which simply holds an integer, and wrapped the Nodes in a ...
2
votes
1answer
36 views

Using reference to head node while reversing linked list using recursion

Referring to my previous post, should I consider using current pointers for this code snippet for reversing a linked list using recursion? ...
4
votes
3answers
107 views

Simple Single Linked List - follow up

Based on the previous question, I have utilized most of the answers. The code is now fully compatible with the STL by implementing forward iterators to store and retrieve values. Using raw pointers ...
5
votes
2answers
248 views

Simple Single Linked List

I'm currently studying data structures, I have implemented simple single linked list as shown below. I would like to know how can I improve it? ...
1
vote
1answer
50 views

Printing a singly linked list with time complexity O(n) and space complexity O(sqrt(n)) [closed]

My aim is to write a method which prints contents of a singly linked list in reverse order with time complexity \$O(n)\$ and space complexity \$O(\sqrt{n})\$. The best I could come up with is to store ...
1
vote
1answer
41 views

Data structures in C (doubly linked list)

NOTE: Added corrections based on feedback. The DobLLRemoveNode function now works properly. It will stop if the given value is NULL and it will not set the tail to the head unless they are the same. ...
3
votes
2answers
43 views

LinkedList Queue implementation

I'm working on a project which simulates (very simple/watered down) a network. The basis of this is to learn how to implement a Queue. I understand there are many ...
3
votes
1answer
64 views

Data Structures in C (Single Linked List) - Follow-up

This is a follow-up from my previous question! I cleaned up the code and added all the notes from the answers. I have also updated the code on github LinkedList.h ...
3
votes
3answers
177 views

Data Structures in C (Single Linked List)

NOTE: Added a follow-up question with the reviewed code I am trying to get back to basics with C, so I am doing some data structures in it. The following is my implementation of a Single Linked List ...
1
vote
3answers
137 views

Merging two sorted linked lists C++

Routine to merge two linked lists together and return a new merged list. One optimization I can think of is passing by reference instead of value. Any other suggestions ? Is there a shorthand to make ...
5
votes
1answer
269 views

Bucket Sort with Linked List

This is my implentation of Bucket Sort, but I see myself using way too many for loops, is this necessary? ...
1
vote
1answer
69 views

Reversing a linked list recursively

This appears to work. Are there any edge cases I am missing? What are your thoughts on the algorithm and implementation? ...
3
votes
2answers
79 views

Multiply linked list - implementation

I don't know what is the common name for this data structure I named it like this due to a definition in wikipedia that states the following: In a 'multiply linked list', each node contains two ...
2
votes
3answers
88 views

Reverse part of a linked list

I'm learning data structures. I'm working on linked lists at the moment, and I'd like to have a strong grasp on them. Below is the last problem I solved. I'd like to know what you think of the ...
5
votes
3answers
546 views

Implementing a singly linked list in C++

I'm really just looking for some advice on my current code and with moving forward. As you can see, I have a pointer to my student list and data (which just haven't been made yet). ...
5
votes
3answers
239 views

Deleting all the matching items in single linked list

I have the following code which I implemented to delete all the nodes for the matching value. My code handles all the 63 varieties of test case scenarios including scenarios like deleting 1 from ...
3
votes
1answer
66 views

Stack implemented with a linked list

I have made a basic stack class utilizing a linked list for data storage and \$O(1)\$ push and pop and just want some basic feedback on the class to see if there is anything basic I missed. It seems ...
7
votes
4answers
1k views

Inserting a node to a given position in a linked list

Given You’re given the pointer to the head node of a linked list, an integer to add to the list and the position at which the integer must be inserted. Create a new node with the given integer, ...
5
votes
4answers
187 views

Utility functions for a linked list

I have written code to add a node to the head of the list. Criticisms and feedback are welcome. ...