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
26 views

First Linked List in Java

I just started learning Java, and wrote up a linked list. I'm coming from just having learned Haskell, so I've been out of the mindset of stateful computations for awhile. I'd like to know how it ...
-1
votes
0answers
21 views

Linked List in Python [on hold]

I currently have a functioning piece of coding that correctly works using a linked list in Python. I am currently trying to error proof the code so that if the user selects number 3 on the menu the ...
0
votes
2answers
42 views

Is this implementation of doubly linked list correct?

I am trying to follow the template provided here to create a doubly linked list in java. This homework is based on this lecture. Can someone please review my implementation? No change to this part of ...
3
votes
1answer
67 views

Removing duplicates from unsorted LinkedList

Removing Duplicates: ...
2
votes
1answer
42 views

Implementation of a singly linked list

I wonder if the code below is a good (quality and correctness) implementation of a single linked list in C++, in regard of data structure (not the exposed interface). ...
0
votes
0answers
16 views

C programming - linked lists [closed]

When i run the following program, for some reason the code gives me a segmentation fault (core dumped). ...
1
vote
1answer
29 views

Using composition or inheritance to enhance this linked list

Problem Statement: A method called insertEnd() exists, but it runs in linear time, because every time it is called, it walks down the list to find the end. Without changing the meaning of this ...
1
vote
1answer
42 views

Creating an insert at front function for a circular doubly linked list

I have only been working with C for a couple of months and I think I have a pretty good function to insert a node in the front of the circular doubly linked list. I have tested in adding several ...
6
votes
2answers
68 views

Immutable Linked List in VBA

I made an immutable list class using the head-tail idiom. If I did this correctly, it implements persistent data structures. Unfortunately it doesn't scale well ...
2
votes
1answer
218 views

Optimizing twin() method

Part III of this question says: Fill in the twin() method in the SList class so that it performs as indicated in the ...
4
votes
2answers
82 views

Optimizing squish() method further

Part II of this question says: Fill in the squish() method in the SList class so that it performs as indicated in the ...
7
votes
3answers
183 views

Linked list C implementation

I'm reading a data structure and algorithm book in C. I have implemented a generic single linked list in the C programming language, and I want to know your opinion on my implementation: ...
6
votes
3answers
85 views

Singly Linked List Implementation in C

I'm preparing for an interview soon, and I've written the following linked list implementation from scratch. This is all self-taught, and I'm still working on my C. I feel that the implementation is ...
7
votes
2answers
182 views

Linked list implementation of a stack

I am working on a basic linked list implementation of a stack of ItemType (currently set to double but can be changed) values. The stack code will then be used in a ...
1
vote
1answer
28 views

Self-made linked list implementing List<E>

I have to make a linked list as a quasi-homework task, about which I have already asked two questions about here and here. Since the whole code is really big (400 lines approx.), I will include only ...
5
votes
3answers
198 views

Custom linked list implementing Iterable used as stack

I have created a custom linked list that implements the Iterable interface. I am then using this linked list to implement my custom stack. I have also thrown a ...
8
votes
2answers
92 views

Self-made linked list iterator

I recently made a linked list for myself, the code of which was posted here, if anyone would be interested. Now, as the next task, I had to make an Iterator for my ...
2
votes
2answers
108 views

Creating a singly linked list of structs

I'm pretty new to linked lists - I understand the concept and how they work - but coding them is a bit more...complicated. I have some code below that I'm using for homework - essentially we're to ...
14
votes
5answers
1k views

Self-made Linked List

I was tasked by my teacher with making a linked list by myself, so I could understand the concept better. Here is the MyLinkedList class: ...
1
vote
0answers
50 views

Unrolled linked list with iterator [closed]

I'm making an unrolled linked list (linked list with an array of 50 in each Node) for a class project with an iterator. In addition, whenever more than half of the arrays are unused (they would all be ...
4
votes
3answers
538 views

Double Linked List remove method

I am implementing some basic data structures to freshen up my memory and I wanted my DoubleLinkedList remove method to be reviewed. I feel like it has extra checks ...
8
votes
5answers
392 views

Simple LinkedList implementation

I am brushing up my Data Structure knowledge (for preparation for internship interviews) and I started by implementing a very simple Linked List class. This is by no means intended to be able to ...
4
votes
1answer
112 views

Filling a container with objects using pointers / iterators

I have a series of nested objects that I need to serialize into a byte (unsigned char) array to send out to another computer over UDP. Right now I each object ...
2
votes
1answer
284 views

Generic Stack implementation in C-style C++

I implemented generic stack in C. Seems to work fine. It doesn't work for strings, though. It was compiled using Visual C++. Implementation: ...
1
vote
1answer
47 views

Singly linked list 2.0

Version 1.0: Singly linked list The struct and the prototypes of the functions were given in the question. I am unfortunately aware that this is more C code and ...
2
votes
2answers
761 views

Unsafe Stack in C#

I was interested to see if it was possible to implement an unsafe stack in C#, so I wrote this: ...
6
votes
2answers
252 views

Templated Doubly-linked-list

I've been wanting to revise what I knew on templated classes so thought I'd write a doubly linked list to practice. It works fine, so all is well and good on that front, but is there something I've ...
1
vote
1answer
83 views

Doubly circular linked list implementation with successive update in O(1)

For the queries mentioned in link in 3 parts, the first two parts have been addressed, as mentioned below: Part I (6 points) list/DList.java contains a skeleton of a doubly-linked list class. Fill ...
3
votes
1answer
59 views

Implementing a linked list

I am studying data structures at the moment, so I want to see if there is anything wrong with my implementation of linked lists in C, after I checked Implementing an ArrayList. Header ...
10
votes
2answers
513 views

Always sorted list

In this list, each newly inserted element is put in its place in order using IComparer<T>. The implementation uses a ...
2
votes
1answer
102 views

How should I write function to print a singly linked list in a reverse order?

I am preparing for interview and I want to write the function in the way that the interviewers will expect me to write. This is my solution: ...
5
votes
2answers
583 views

Remove Nth Node from End of Linked List

I am solving the well known problem Remove Nth Node From End of List: Given a linked list, remove the n-th node from the end of list and return its head. Assume that n is between 0 and the ...
3
votes
3answers
239 views

Implementation of a doubly linked list in Java

I'd like to improve this code. DoublyLinkList.java ...
3
votes
3answers
161 views

Is SList class an ADT?

As per the definition given in lecture, ADT is, With reference to this definition, I would like to call SList class an ADT following 6 invariants: Multiple ...
4
votes
1answer
1k views

Queue Implementation using a Linked List

For understanding the concepts, I've implemented the Queue data structures using a linked list. Is there anything to improve? LinkList.java ...
5
votes
4answers
496 views

Creating nodes for linked list in a while loop in C

I am trying to create nodes for a linked list in a while loop. The code works, but it is not very pretty. How would I get the same results the proper way? ...
6
votes
3answers
1k views

Stack implementation using a linked list

To understand the concept, I implemented the stack operations using a linked list. Please review the code and tell me your suggestions. Node.java ...
2
votes
2answers
80 views
3
votes
2answers
124 views

Merge sorting linked lists

This works as expected and I want to get this code reviewed so that I can improve my coding ability. I am concerned about readability and the quality of the code ...
0
votes
1answer
55 views

Possible memory issue in linked list program [closed]

I am trying to write a program which will count the occurrence of words in a paragraph. The logic I am following : I am using a linked list for the purpose. And I am searching sequentially - if new ...
5
votes
1answer
153 views

Simple Linked List with my own super classes and interfaces

I have provided a simple implementation of a linked list using my own super classes and interface. The implementation is for adding, deleting obtaining the size of thew list. I have not yet provided ...
1
vote
3answers
854 views

Josephus Problem in Java

Problem The Josephus Problem is a famous mathematical puzzle that goes back to ancient times. There are many stories to go with the puzzle. One is that Josephus was one of a group of Jews who ...
2
votes
2answers
94 views

Swap Kth node from beginning with Kth node from end in a Linked List

Given a singly linked list, swap kth node from beginning with kth node from end. Swapping of data is not allowed, only pointers should be changed. This code is attributed to geeksforgeeks. I'm ...
1
vote
3answers
280 views

Alternating split of a given singly linked list

Write a function AlternatingSplit() that takes one list and divides up its nodes to make two smaller lists 'a' and 'b'. The sublists should be made from alternating elements in the original list. ...
3
votes
4answers
902 views

Delete duplicates from unsorted linked list

E.g: if a linked list contains 2->3->1->3->4 then the result should be 2->3->1->4. Notice that 3 has been eliminated. This code is attributed to GeeksforGeeks. I'm looking for code-review, ...
2
votes
2answers
85 views

Find a triplet from three linked lists with sum equal to a given number

Given three linked lists, say a, b and c, find one node from each list such that the sum of the values of the nodes is equal to a given number. For example, if the three linked lists are ...
4
votes
4answers
357 views

LinkedList to be used in a stack or queue

This all works. Just wanted to make sure I didn't miss anything. Coming from C++ and working my way through Algorithms, 4th ed. Here is my LinkedList class: ...
3
votes
3answers
125 views

Delete alternate nodes of a linked list

If the linked list is 1->2->3->4 then the output should be 1->3. If the linked list is 1->2->3->4->5, then the output should be 1->3->5. The question is attributed to GeeksForGeeks. I'm looking ...
1
vote
1answer
107 views

Extract Leaves of a Binary Tree in a Doubly Linked List

Given a Binary Tree, extract all leaves of it in a Doubly Linked List (DLL). Note that the DLL need to be created in-place. Assume that the node structure of DLL and Binary Tree is same, only the ...