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

5
votes
0answers
14 views

Social network graph of characters in a novel

I wrote a C program that builds a social network graph of characters in a novel. The program takes two text files as input: a list of the names of the characters in the novel, and the file of the ...
2
votes
2answers
46 views

Adding two singly linked lists in C++

I took a challenge from a web site. I aim to have a runtime performance as good as possible. My solution was accepted, though I think it is not the most efficient because I saw others having a faster ...
-2
votes
0answers
35 views

Am I writing this insert function for a linked list in c++ efficiently? [on hold]

By efficiently I mean, using as little lines of code and if there are any errors please point them out. Thank you. ...
3
votes
1answer
51 views

How to make doubly linked list design more efficient?

I have played recently and implemented doubly linked list with merge sort algorithm. I was wondering if there is any way of improving the algorithm further to make it as fast as possible (I know about ...
5
votes
2answers
73 views

Find minimum node in Linked-List

I wrote a method that will return the minimum element in a linked-list that operates in O(1) time. I tested and everything works fine. However, I was wondering if there is anything that I can do to ...
1
vote
2answers
64 views

linked list in c code

I have implemented linked list data structure in c. linkedlist.h ...
4
votes
1answer
77 views

Avoiding pointers in this C++ linked list

As I know it is not good idea to have so many pointers in c++ code. But I have written this simple implementation of linked list in c++ and there are many pointers in it, how can I improve that? Also ...
4
votes
3answers
93 views

Recursive methods of singly linked list

Can anyone review the methods? If there are better ways to write a certain method I would appreciate it if anyone could tell me. ...
5
votes
1answer
126 views

My first implementation of a linked list in C++

This is my very first implementation of a full-fledged ADT, which could potentially be use-ready. Now, I'm still learning, therefore I would like to ask you what I can do to further improve the ...
2
votes
0answers
42 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>. ...
0
votes
1answer
38 views

Detecting cycle in LinkedList

Is this a fair/clean way to detect a cycle in a LinkedList? Should work for both single and double LinkedLists'. ...
0
votes
1answer
22 views

Generic LinkedList with add/exists/delete/dlear/iteration functionality

I've just been going through core data structures and algorithms recently, wanting to get back in touch with the core fundamentals. I'm starting simple with a ...
5
votes
2answers
103 views

Single Linked-List Implementation in C++

I haven't done much C++ coding the last few years, so I've been reviewing in preparation for upcoming interviews. I wrote a minimally functional singly linked-list. I'm using my implementation for ...
-1
votes
1answer
17 views

Singly linked list abstraction in ES5 JavaScript

Below is the code for, Singly linked list implementation, ...
4
votes
3answers
83 views

Check for palindrome in singly linked list

Looking for code review, optimizations and best practices. Node.java ...
5
votes
2answers
74 views

Doubly linked list of strings

This code works just fine as I get the correct output. However I want to make my code more simple. I want to avoid using the setPrev(Node n) method and would rather ...
2
votes
2answers
68 views

A linked list with push pop append and destructor

I tried to implement a linked list that can do pop(), push(), append(), printall(), and so on, and also I tried to handle the wraparound features, and de-wrap it when check if the list is cyclic to ...
2
votes
2answers
106 views

C++ Generic Linked List

My goal is to write a reasonably robust c++ linked list class. The current code represents the latest phase in this attempt. My future goal is to implement a doubly linked list along with more member ...
4
votes
2answers
41 views

Copy Constructor for a linked list with self-referential pointers

I came across a coding challenge that looked something like this (recreating from memory, sorry) Suppose you have the following interface for a linked list. Implement an efficient and correct ...
3
votes
2answers
70 views

Stack and Queue implemented with a LinkedList

I am looking for feedback on my implementations of Queue, Stack, and LinkedList using Java ...
3
votes
1answer
244 views

Small improved std::list to manage doubloons and pointers

I am extending std::list in order to have access to convenience member functions that simplify my everyday developments (e.g. ways to deal with doubloons, delete ...
1
vote
1answer
46 views

Custom C++ STL-like doubly linked-list(C++11)

This is the link list I just created. It works fine for now, but would want to know if I could make it better. list.hpp ...
1
vote
1answer
63 views

Checking if a single linked list is a palindrome in C++

The following is my first try at this classical interview question. It is quiet different from the solutions Gayle Laakmann provides in her book, and in another question on stackoverflow, someone ...
2
votes
2answers
79 views

Linked list copy constructor

This is a working linked list that will be used as a vector. Instead of using dynamic arrays, I am using a linked list. I would like to see a more concise solution without utilizing the STL. ...
3
votes
1answer
61 views

Merging sorted linked lists - C++

Problem from hackerrank: You’re given the pointer to the head nodes of two sorted linked lists. The data in both lists will be sorted in ascending order. Change the next pointers to obtain a ...
2
votes
0answers
54 views

lock-free list performance

I tried to write a lock-free list in c++ unfortunately the performance compared to a std::list secured with a simple mutex is bad what do you think? Are there major performance or code-style issues? ...
2
votes
1answer
51 views

Custom OrderedLinkedList class with nested OrderedListNode class

Everything works with this program. It takes both Strings and ints, however, I feel like my add method is simply too verbose. Does anyone believe I can implement a shorter version of this, or is it ...
2
votes
3answers
76 views

Java Doubly Linked List Implementation

I recently submitted an implementation of a singly linked list and tried to apply some of the suggestions on this implementation. I decided not to implement the List interface as I only wanted to ...
8
votes
2answers
396 views

Java Singly Linked List Implementation

I've implemented a singly linked list in Java as a practice exercise and would appreciate a review. LinkedList.java ...
12
votes
3answers
1k views

Singly Linked list implementation in C++

How can I improve this code Please tell proper indentation and usage of camel-case. ...
0
votes
2answers
93 views

Double linked list c++

I'm trying to figure out double linked lists. I'm looking for any type of comments you might have for my code. Anything that will make it better. ...
4
votes
1answer
326 views

Time limit exceeded for java “insertion sort linked list”

I was working on LeetCode to practice myself with Java programming. I encountered a question about insertion sort a linked list. My code currently runs correctly, but it failed on an instance with ...
0
votes
2answers
95 views

Linked list with deep copy constructor

I've created a linked list template class which contains a copy constructor that performs a deep copy of the list. LinkedList.hpp ...
1
vote
1answer
70 views

Simple linked list program in C

This is my simple linked list program in C. What is the best way to write this? ...
8
votes
2answers
101 views

C++ linked list class

I have a lot of experience in Python and Haskell but am new to C++, so I'm wondering if my code is idiomatic. For one of the first assignments in my class, I wrote a linked list class (the "cities" ...
1
vote
1answer
41 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 ...
4
votes
0answers
59 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
132 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
44 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
66 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
61 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
74 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
92 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
49 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
45 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
70 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
121 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
33 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
85 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
93 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 ...