Category "linked-list"

C++ reordering Singly Linked List

Hi I'm trying to write a code for singly linked list that reorders the nodes so that: L1->L2->L3->...->Ln to L1->Ln->L2->Ln-1->L3-&g

error: request for member is of non-class type string & char

this is my Node Structure; class Node { public: string data; Node *next; Node *child; }; Node * createList(string *arr, int n) { Node *head = NU

Split linked list c++

For this function, the return value type should be Forward_list, but I assign the list with node value type, so what's the alternative so that my_list.head_ ret

Freeing the Memory of a list that contain lists

I have an assignment where i have to create a radix sort method using linked lists. First i create a sequence/list of random numbers then perform radix sort on

I don't understand how nodes work in a linked list [closed]

I have a basic understanding of usage of nodes, like node = node.next, and self.head, and things like node.next = self.head self.head = new_no

Why is my linked list size function not working as intended?

I used the following code to define my linked list, nodes and a few functions. class node: def __init__(self,node_data): self.__data=node_data

Linked List Deletion function causing program to crash *wrong pointers?*

In my program when a username is following another one and also has posted a "tweet" which is a string in an attempt to delete the followed username it breaks t

How to represent sparse matrix (including zero elements) in C using linked list?

I want a code that represents a sparse matrix including zero elements using linked list, I basically want the output to be like this: 1 0 0 0 0 6 1 0

Practicality of the position attribute of a Positional List Implementation in Python?

I am reading Chapter 7 of Data Structures and Algorithms in Python and I am finding the Positional List ADT quite hard to understand, the implementation given b

Linked list value double_up() method causing TypeError

I am trying to implement a linked list in python and trying to create a method that doubles the value of each element in the linked list. This method updates th

Is it possible to create new linked list nodes inside a loop in goLang?

I need to create a nodes for a linked list and return the head inside a Function. Definition for each node: type ListNode struct { Val int Next *ListNo

Create a linked list with the characters of a string-C90

The problem : I am trying to create a linked list which contains the characters of a string in each field of the linked list(to get the distance of each letter

How can I repair this error that occurs occasionally when my code is running?

Sometimes the code runs till the end without any errors while other times it stops in the middle and gives me this error Thread 1: EXC_BAD_ACCESS (code=EXC_I386

i can't seem to understand a C code to sort a linked list of data

i have been given a code to sort a linked list that contains links (we call them maillons in french, sorry i don't really know how it's called in english) of Op

Converting an array into a linked list in Golang

definition of linked list: type ListNode struct { Val int Next *ListNode } insert helper that does the pointer manipulation: I am aware that root.Val

Why does it iterate one more time even if it is NULL?

Similar question here . What I want to understand is that when current_node is NULL, the compiler doesn't see it as NULL and iterates one more time. void pr

What is wrong with Insertion Sort on Doubly Linked list?

I am getting some random result. I have gone through the flow and did dry run several time but can't figure out exactly what's wrong with the code. flow of prog

Location of toString() Method of java.util.LinkedList

I am studying LinkedLists and wanted to check Java's implementation. However, I have some questions. I saw that I can print the contents of java.util.LinkedList

I'm having a problem creating a linked list [duplicate]

#include<stdio.h> #include<stdlib.h> void insert_front(struct node* head, int block_number); void insert_rear(struct node* head,

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