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

4
votes
2answers
103 views

Implementing a Singly Linked List

I am implementing, in my SinglyLinkedList class, an interface where I redefined linked list. I am trying to learn data structures. Please, let me know what I can ...
2
votes
0answers
34 views

Simple stack and linked list

I know that Python has a built-in list data structure, but I want to implement my own linked list and stack data structures for practice. I have three classes ...
2
votes
1answer
58 views

Priority Queue Linked List Implementation

I am new to Python and wanted to make sure my code answers the question for my assignment due. My Task: A priority queue is a queue in which each item is assigned a priority and items with a ...
5
votes
2answers
74 views

Doubly linked list: iterator/pointer arithmetic

I'm using a doubly linked list container I've written as the working example. The textbook I'm using is from 2001, so feel free to point out where later versions of the C++ standard should be used ...
2
votes
1answer
44 views

Linked list library in C

I just finished my linked list library in C and I am trying to find out what should be improved. The functions provided by the library are members of the main data structure (very important). The ...
3
votes
2answers
96 views

Double-ended linked list

I want to know if there is any redundancy in the code or if it is missing something. I ran it with several different choices and it works fine but I still want to know are there any more subtle ...
6
votes
4answers
145 views

Summarizing calories for a food diary

I'm new to C and I've been working on some code for a project for school. This was the finished result and now that I'm done it, I came back and tried making it better. So I was wondering, how would I ...
2
votes
1answer
45 views

Common operations on a linked list (user defined)

I have just started learning data structures and for the past two days I was going through linked lists. I have implemented the basic/common operations on the linked lists and I would love for some ...
3
votes
1answer
35 views

An implementation of a double linked list

Here is my implementation of double linked list. Is it possible to reduce the code and improve it? Some methods here: head (returns head of the list) tail (returns tail of the list); append ...
2
votes
3answers
324 views

Implementing a linked list using C++

Any suggestions? ...
5
votes
1answer
44 views

Mergesort a LinkedList

I have made an attempt to write the mergesort routine on a LinkedList in Java. It will be great if somebody can review my implementation and point out the issues ...
3
votes
1answer
59 views

Sort a linked list with merge sort in C

This is my version of a linked list in C. The function mergeSort requires a reference to the first and to the last nodes, as well as the indices of the first and ...
2
votes
1answer
67 views

Determine the index where two lists diverge

Background A class provides an API to determine the index where two string lists diverge. ...
6
votes
3answers
174 views

Stack with getMin method

This should implement a stack that has a \$O(1)\$ getMin method. I used an auxiliary stack. Please provide comments on my solution. ...
3
votes
3answers
173 views

Implementing sequence abstraction

Below is the code that implements sequence abstraction using type abstraction Sequence (in Java): ...
2
votes
1answer
35 views

Singly-Linked List In-Place Reversal

I've created a function in C to reverse a singly-linked list in place: ...
1
vote
1answer
27 views

Reading from file and storing as Linked List

This is the code I have: ...
1
vote
2answers
39 views

Univariate polynomial multiplication using Doubly Linked List

A univariate polynomial is a polynomial over a single variable, and in the following discussion when we say polynomial, we mean a polynomial in a single variable. You are given two polynomials ...
1
vote
1answer
30 views

Inserting nodes into a singly linked list based on size of number

Given a set of numbers insert them so that they are ordered ie. ...
5
votes
1answer
61 views

Tree list recursion from Stanford tutorial

I have found this appearing-to-be famous problem in Stanford tutorial about trees and decided to solve it. My solution appears to work great: ...
1
vote
1answer
44 views

Deleting node from LinkedList

I have this function to remove nodes that matches a certain criteria in the list. Initially when I wrote it, head node was not deleted if ...
5
votes
2answers
105 views

Kth to last element of a singly linked list

Find the kth to last element of a singly linked list Any comments? ...
3
votes
2answers
150 views

Delete an item from a linked list

I wrote this code to delete an item from a linked list. I checked it and it works, but I want to know if the logic could be written simpler or clearer. ...
3
votes
1answer
67 views

Remove odd valued nodes from linked list

The function remove_odd is to remove odd valued nodes (surprise!!) from the linked list head. The code is very long and cryptic but it seems to work. Please help ...
1
vote
2answers
69 views

LinkedList implementation (+Sorted)

I was recently learning about nodes and how they work in lists, and to test myself, I decided to write my own LinkedList ...
12
votes
1answer
139 views

Chack miy spellang pleez

For my CS2 project, I am supposed to implement a spell-checker. It is supposed to follow the following: Prompt the user for the name of the file containing the dictionary of correctly ...
4
votes
3answers
255 views

Simple Linked List that holds an int

I am inexperienced in C++. I was able to get my LinkedList to be fully functional. I was hoping to get some feedback as to whether or not I followed bad practices ...
6
votes
2answers
404 views

C++ Linked List Implementation

I'm learning C++ and also about data structures, so I am trying to implement some. This is my linked list. I've included two different ways of getting the length of the list, with a ...
2
votes
2answers
56 views

Implementing a Trie in Python using lists alone

I've been working on implementing a Trie in Python for educational purposes. I tried implementing one using dictionaries and I was successful. The structure of a trie with the words ...
11
votes
5answers
863 views

Singly Linked List in Java

I created my own implementation of a Singly Linked List. Is there anything I can improve on, in terms of effciency. Also, what other methods would you recommend for me to try and implement. My goal is ...
5
votes
2answers
166 views

Edge cases for simulated malloc function

I'm trying to simulate the malloc function in C by using mmap and having 2 linked lists to act as memory blocks. The program ...
5
votes
4answers
523 views

C Doubly Linked List

It works, but it seems a bit long winded. I'd like some critiquing. ...
0
votes
2answers
165 views

Using recursion to count nodes in a binary tree, test equality of linked lists, and find extrema of a linked list

I am working with a some small functions to test recursion. I am fairly new to Python and am wondering if there is a cleaner way to get the job done. ...
2
votes
0answers
51 views

Reverse every k nodes of a linked list [closed]

Given a linked list and a number k, Reverse every k nodes in the list. Input: 1->2->3->4->5->6 and k = 1 Output: 2->1->4->3->6->5 How can I ...
1
vote
2answers
91 views

Reverse linked list using recursion

Here is my code to reverse link list in using recursion: ...
2
votes
0answers
74 views

Simulating a linear linked list using an array

A program to simulate a linear linked list using an array: Specs: A y : Create a new node with data value y, and append this node to L I x y : Find the node t with value x, create a new ...
3
votes
0answers
43 views

JavaScript Doubly Linked List

I coded up a basic DLL for use in a Stack or a Queue in JAvaScript for practice. Coming from a C++/Java background so I basically just converted how I would code it up in one of those, not sure if ...
2
votes
0answers
64 views

Linked list order reverse program efficiency

Here is my function which convert linked list in the following order: Example: Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3 Output: 3->2->1->6->5->4->8->7->NULL. Code: ...
3
votes
2answers
61 views

Functional-style linked list written in C

For my Operating Systems class, I needed a linked list data structure and didn't have one already written. During the course of thinking about how to implement a linked list again (it had been a ...
1
vote
1answer
34 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 ...
5
votes
1answer
61 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
163 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
159 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 ...
4
votes
1answer
69 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
104 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
39 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
66 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
53 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
143 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 ...