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

Make a new design of Stack with a new function

I am doing some coding exercise, and I am not sure if I have met the requirement. Can someone help me to figure it out? How would you design a stack which, in addition to push and pop, also has a ...
0
votes
0answers
23 views

How to get elements of list in a defined order in python? [on hold]

I have a list like this: list = ["Resttorf","T12/14 Frastorf","T16 Frastorf","FBP16 Baggertorf","E Sodentorf","E Frastorf","S8/10 Frastorf"] I have to organise ...
5
votes
1answer
41 views

Self-made LinkedList and Node

I have recently made two kinds of linked lists in Java. I know that there is one with generic and one without. However, what I am really concerned about is which style should be used mostly (or which ...
5
votes
2answers
97 views

Data structure to count occurrences of entries

I would love to hear any thoughtful suggestions on how to improve my programming style in order to be more understandable. Listed below is a sample of my code which I wrote in Eclipse: ...
5
votes
3answers
140 views

Optimize huge text file search

I have several huge 100MB text files that I need to scan through to pick out certain frame numbers which relate to a specific log packet of interest. My plan was to scan for these frame numbers and ...
3
votes
1answer
51 views

Design/reiterate or code reuse for linked list

This is what my class hierarchy looks like. I have an abstract superclass, AbstractLinkedMyList, that contains common operations for both sorted and unsorted linked ...
2
votes
1answer
44 views

Circular Queue using Linked List

I want to create a circular queue using a linked list. I also want to create many instances of that data structure (queue) without repeating the code. This is what I came up with: ...
3
votes
1answer
38 views

Returning the next node

What is considered to be a good programming practice for returning value from the function? For example, if we have a function in C named ...
2
votes
1answer
55 views

Rewriting linked list function without a NULL variable

This is how my LinkedList class looks like in PHP. I am trying to figure out if I can rewrite my reverse_list_recursively() ...
4
votes
1answer
15 views

Zip / merge two linked lists together

The following code interweaves two linked lists together in three flavors: iterative, recursive top-down, and recursive bottom-up. My iterative solution feels like it can be optimized better and my ...
3
votes
3answers
72 views

Implementing a singly LinkedList and IList interface

I have implemented a LinkedList in C#. What would you change/make better? What naming conventions are misused? What would you add? Some of my ideas are to make it ...
4
votes
1answer
59 views

Circular linked list in C

Let me know if it seems right to you and if anything can be optimized. My concern is that I'm unsure if circular linked lists are supposed to have a tail. I've implemented it just using a head. Is ...
2
votes
2answers
54 views

Doubly linked list code in C

Let me know if it seems right to you and if anything can be optimized. ...
1
vote
2answers
52 views

Sort and display input numbers

How do I decrease time, especially in sorting? Given a list of numbers, you are to sort them in non-decreasing order. Input t – the number of numbers ...
6
votes
3answers
76 views

Removing duplicates without using a temporary buffer

This question is from Cracking the Coding Interview and in this question they have asked to solve without using temporary buffer. I have used Iterator interface. Can I use it or need to re-implement ...
3
votes
2answers
69 views

Custom iterator for a linked list class

I have made a LinkedList class. This is a singly-linked-list and I want to make a forward_iterator for this class without using ...
3
votes
1answer
73 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
47 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 ...
2
votes
1answer
77 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. ...
12
votes
2answers
96 views

LinkedList (doubly) implementation

CKLinkedList is the implementation of a doubly linked list. I'd like to see comments on the memory management (I'm using ARC in the code below) and formatting + ...
8
votes
2answers
95 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
93 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
62 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
51 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
73 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
111 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
84 views

Removing duplicates from unsorted LinkedList

Removing Duplicates: ...
2
votes
1answer
60 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
43 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
75 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
90 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
235 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
97 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 ...
8
votes
3answers
256 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
104 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
245 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
35 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
543 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
121 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
145 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
52 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
1k 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
425 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
208 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
430 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
51 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
801 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
314 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 ...