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

2
votes
0answers
19 views

Convert binary tree to doubly linked list

The code works and I get the results I want. Please comment about complexity, a shorter way of implementing the solution, and advice for better unit tests. ...
0
votes
2answers
19 views

Split a Map into sublists

I may get a Map of many many items that needs to be requested to an API. In order to improve performance, I thought about splitting that list into smaller ...
0
votes
0answers
25 views

Deep copy linked list with arbitrary nodes

The original question can be found here. I implemented method 2: Please comment about style, unit testing, code complexity, time and memory space and complexity. ...
9
votes
2answers
52 views

LinkedList (doubly) implementation

CKLinkedList is the implementation of Doubly Linked List. I'd like to see comments on the memory management (I'm using ARC in the code below) and formatting + overall style; CKList protocol file: ...
2
votes
0answers
38 views

Documenting JavaScript code [on hold]

I am in the process of documenting some other JS website functions and am tasked with creating a documentation page that can be used as an example for other members of the organization. Inside my ...
8
votes
2answers
87 views

The benefits of sentry in a linked list

I'm trying to put together a little tutorial to demonstrate the benefits of using a sentry node when creating a linked list. Target audience is novices that already tried to make a linked list. Any ...
1
vote
4answers
90 views

Is this the right way to delete a node?

This is how I am deleting a node from a singly linked list. Would this be the most correct way? ...
2
votes
1answer
33 views

Simplifying linked list insert_after

Is there a better way to insert after a node in a linked list? Currently I go through the node from the head of the list and find the node that has the value pos. ...
5
votes
1answer
61 views

TrackDAO: what can be improved?

In this specific situation there is a table with trackdata and a form to add rows. For the sake of clarity I won't include the view-related code here. The added rows are added to a LinkedList when ...
2
votes
1answer
49 views

Form a loop with previous and next

I have a class Edge which looks something like this: class Edge { Edge previous; Edge Next; } I have edges in an ...
3
votes
2answers
69 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 ...
0
votes
2answers
70 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
76 views

Removing duplicates from unsorted LinkedList

Removing Duplicates: ...
2
votes
1answer
52 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). ...
1
vote
1answer
38 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
54 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
79 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
223 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
90 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
208 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
89 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
213 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
33 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
323 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
102 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
122 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 ...
15
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
51 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
972 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
406 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
148 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
349 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
49 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
777 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: ...
10
votes
2answers
300 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
129 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
62 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 ...
11
votes
2answers
538 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
120 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
743 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
329 views

Implementation of a doubly linked list in Java

I'd like to improve this code. DoublyLinkList.java ...
3
votes
3answers
164 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
2k 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
614 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
2k 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
89 views
3
votes
2answers
201 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 ...
-1
votes
1answer
64 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
194 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
1k 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 ...