Category "linked-list"

Does adding a star after a pointer struct definition make it a double pointer?

I have a struct typedef struct hash_entry_{ char *string; void *data; struct hash_entry *next; }hash_entry, *p_entry; I am referencing p_entry later i

Adding a node to the beginning of a double-linked list

I am trying to create a function that adds a node to the beginning of a double-linked list in C++, and I'm getting this error in Xcode. I know it must be becaus

LinkedList Add Two Numbers: LeetCode

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single

How to convert circular linked list into singly linked list

First, I make circular linked list that look like 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> (head) Now, I am trying to convert this circular linked list

How can I access and iterate through an ArrayList of Linked list element?

I am trying to write a code of adjacency list implementation of the graph ADT. private ArrayList<LinkedList<Integer>> adjLists ; but I don't know

Interesting C macro, how is it able to take a field within a struct and return a reference to the struct?

I saw an interesting design for a doubly-linked-list inside the Pintos operating system and I don't quite understand how it was able to achieve this behavior. I

debug an array of linked lists in c

I'm having a trouble in my project, at first I made one linked list and it worked properly but then I had to edit it and make it an array of linked list, but it

Mutation in javascript?

In the below code size2() method working fine.But in size1() it is mutating the object and making it null.why such behavior is not happening in size2()? class N

Check If Linked List is Palindrome in JavaScript

I have written the following function in JavaScript to check if a singly Linked List is a palindrome. However, I'm failing 2 out of 10 tests, and I can't figure

Remove Duplicates from sorted list not passing all testcases

This is a question on leetcode. For some reason my code only works for 7/164 test cases. i would like to know why my algorithm is not efficient. what is a solut

Random access of a linked list element

In an article about linked list, it is said that accessing a random element is not allowed and to access a certain node we need to traverse it from the head nod

Converting a list to a linked list

I'm trying to figure out to convert a list to a linked list. I already have a class for the link but I'm trying to figure out how to convert a list to linked l

How to find the quartiles in the linked list with only one iteration

I have a singly linked list of integers. The node is defined as class Node { public: int value; Node *next = NULL; };

visual studio unallocted pointer not NULL

I've encounter an issue in Visual Studio which drives me crazy. It is regarding unallocated pointers. I wanted to write a simple linked list app.The problem is

Unable to convert class syntax to function syntax for a Linked List

Okay so I'm learning Data Structures where my tutorial is following class syntax. So now I am trying to convert it to function declarations as I want to practic

How to delete a node from a circular linked list in Java?

Given a Circular linked list write a method in Java to delete a node.

What is a Dummy Head?

So I want to know for sure what is a dummy head/dummy node in a linked list. Can somebody tell me the definition and give me an example maybe?