Skip to main content
-3 votes
2 answers
63 views

I was working on this problem from HackerRank trying to insert an element at the tail of a linked list and I have to return the head of the node. def insertNodeAtTail(head, data): if head is None:...
gradstudent1995's user avatar
0 votes
2 answers
104 views

I have the following code to create one-way list of user-specified number of elements typedef struct Node{ int val; struct * Node next; } Node; int main(){ int num; Node * prev = NULL;...
user98967885655's user avatar
0 votes
3 answers
72 views

I’m attempting to reverse a singly linked list in Java, but I'm running into confusion about how references work during the reversal process. Specifically, I don’t understand why setting the next ...
Samrudh S's user avatar
-1 votes
1 answer
65 views

This is my singly linked list code have to implement pop from end and pop from front functions still, but I'm having difficulty in writing pop from end function #![allow(warnings)] #[derive(Clone)] ...
qmzp's user avatar
  • 129
1 vote
3 answers
233 views

I have been reading something related to C language's double pointers, and I have some doubts about the following piece of code. The following piece of code is about the operation of deleting a node ...
user3034702's user avatar
5 votes
3 answers
165 views

#define SIZE 100000 // 1. hash_function() is a function that return an int // 2. snowflake_node typedef struct snowflake_node { int snowflake[6]; struct snowflake_node *next; } snowflake_node; ...
arifnone's user avatar
1 vote
1 answer
64 views

I'm learning linked lists in C, and have come across an error when trying to add a value at beginning of a linked list using functions #include<stdio.h> #include<stdlib.h> struct node{ ...
Cap_Void's user avatar
-1 votes
1 answer
55 views

i have problems with distributing template. i tried with different syntax, but not a successful way with the error text: error C2512: 'node': no appropriate default constructor available for the code ...
Mohamed Elhaware's user avatar
1 vote
2 answers
101 views

I wanted to merge 2 linked list’s elements alternatively. I counted the length of these 2 linked lists manually, then created a dummy-headed node to use for the merge. I am getting the errors "...
RIN's user avatar
  • 11
0 votes
5 answers
104 views

Below is my C code for LeetCode no. 707 "Design Linked List": typedef struct MyLinkedList{ int val; struct MyLinkedList *next; } MyLinkedList, *LinkList; MyLinkedList* ...
Clay_Han's user avatar
1 vote
1 answer
110 views

I'm working on a SinglyLinkedList class in C++, where I maintain pointers to both the head and tail of the list, as well as an integer size to track the number of nodes. My goal is to implement a ...
Math Student's user avatar
0 votes
1 answer
98 views

#include <stdio.h> #include <stdlib.h> struct node { int data; struct node *link; }; int main(int argc, char *argv[]) { struct node *p; p = NULL; Append(&...
AVINASH BHARTI's user avatar
-2 votes
2 answers
49 views

For a singly linked list, should I store the head and size variables, or the head, tail, and size?
Vivyen's user avatar
  • 85
0 votes
2 answers
268 views

I'm working on solving a simple algorithm problem, and here's the question. In a singly linked list L with a head node, delete all nodes with the value x and free their space. Assume that nodes with ...
CN.hitori's user avatar
-6 votes
1 answer
182 views

The merge sort code on Leetcode giving stack-overflow error. ListNode *findMiddle(ListNode *head){ if (!head) return nullptr; ListNode *slow=head; ListNode *fast=head; while (fast!=...
Amit Kumar's user avatar

15 30 50 per page
1
2 3 4 5
178