Category "linked-list"

How to create linked lists using pydantic so auto-completion doesn't break

I am trying to create a linked list using pydantic. The following code works, but I can't get auto-completion to work. As you can see from the attached screensh

How to remove the nth node from the end of the list reversing the linked-list?

I want to remove the nth node from the end of the list by reversing the linked list first and then removing the nth node. I know there's a better solution than

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =

What is the difference between these two codes? (Python: circular singly linked list)

These are the codes for __iter__ method of a circular singly linked list. But I don't understand the difference between the two. def __iter__(self): node =

linked lists implementation in MIPS

I have a few questions about the code snippet below. It was part of assigment we had. I've already done it but my questions are regarding the provided code we w

How do I avoid printing the first node in my linked list?

I'm trying to create a linked list that has 2 data types and a function that inserts nodes. But in order to insert nodes, I have to create at least 1 empty node

Why am I Getting Null Pointer Exceptions in My Linked Lists?

Could someone check my code for why I'm getting NullPointerExceptions in various methods? I've been racking my brain and can't figure out what is wrong. I'm att

Move the head node from a first linked list to the back of a second linked list

When a certain if statement is passed i have to remove the head node from my first linked-list "new_queue" and add this to the back of my second linked-list "re

Why is my Professor's Linked List Printing Backwards?

I have a project that I'm working on for a Systems Programming course. I'm building off of my professor's code. (Please don't mind her lack of labelling, etc. -

codeblocks output differs from online compilers

In short, I should have " 1 2 3 4 5 6 7 8 9 10 ". When executed in CodeBlocks instead of 0 i am getting random numbers. But When compiling using onli

Circular linked list not working after appending 3rd node

It's Showing output for 2 nodes but after adding 3rd node it doesn't showing any output, what i'm doing anything wrong?? This is the append method that i have

Is there a way to make a node of Linkedlist point to a node that isnt next in the list

I am making a snakes and ladders game in C using a LinkedList, I have a square struct that represents squares on the board. I need to add snakes and ladder that

<E> and <Object> differences and usage

Can someone explain me what are the differences by using E or Object for example in a class for Lists, and their singular usage and definition. I have to use th

Pass linked list to function with struct what I doing wrong?

I want to pass liked list to function and create new list. I need some help to understand what I'm doing wrong. I create new pointer and copy the pointer to "cu

Couldn't create a linked list

My create function is not creating a linked list. I can't seem to figure out the problem here. The code runs but I don't get any output. Can anyone figure out w

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