Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
67 views

I am working on a handy reference sheet for my DnD Games, that includes 10 pre-planned encounters of varying difficulty that I want to reference on an Initiative Sheet by referencing the Encounter ...
Jonathan Rogers's user avatar
Best practices
1 vote
7 replies
161 views

So I'm making a linked list for one of my school assignments in C. I found this website that has some helpful code snippets, and I noticed that they use malloc() to allocate more memory every time ...
Klumpy7's user avatar
  • 123
0 votes
1 answer
160 views

I have been trying to create a method that can reverse a linked list. However, it only show the head of the original list without the rest of the parts showing up. I have tried making another, similar ...
Luna's user avatar
  • 1
3 votes
2 answers
126 views

I’m trying to design a generic linked list in C where each node can store arbitrary data. Right now I have the following definitions: typedef struct { int clientID; char name[256]; } Client; ...
F. Zer's user avatar
  • 1,311
-6 votes
2 answers
168 views

I have simple question on C++ linked list. Say I am given a list, I just want to print for each node the value. I found this simple code on the net while (head!= NULL) { cout << head->...
chiva's user avatar
  • 631
1 vote
1 answer
96 views

In this code: // Stack using LinkedList // #include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node* next; }; struct Node* top = NULL; short isEmpty(void) { ...
Rohan Bari's user avatar
  • 7,739
3 votes
3 answers
354 views

How does cache locality impact the performance of ArrayList compared to LinkedList in Java? I've often heard that ArrayList has an advantage in terms of cache locality, but I don't fully understand ...
Marat Tim's user avatar
0 votes
0 answers
107 views

I'm writing a Merge Sort to sort a linked list with inline RISCV asm, everything work fine until I start writing the part of lists merging. Here is my function: typedef struct Node { int data; ...
澪人桐's user avatar
-2 votes
1 answer
55 views

I am trying to print the contents of a Doubly Linked list using the str method by converting the content into string. The problem I face is that it returns the memory location of the values, not the ...
Rigo Estrada's user avatar
0 votes
2 answers
109 views

I'm working on an algorithm to rearrange a singly linked list based on node positions using only a single stack as auxiliary space. The goal is to modify the linked list such that all nodes at odd ...
Poojana Ometh's user avatar
0 votes
2 answers
102 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
1 answer
115 views

I just started my college's data structures and algorithm's course and have some trouble with shifting nodes of even values to the back of my linked list. The function seems to work when there's only ...
irusuugen's user avatar
1 vote
1 answer
71 views

I am trying to understand how recursion works in the following code for merging two sorted linked lists class Solution { public ListNode mergeTwoLists(ListNode list1, ListNode list2) { // ...
itzTiru's user avatar
  • 13
1 vote
3 answers
227 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
0 votes
1 answer
75 views

I am doing problem 234 from LeetCode. I have a function which takes as its input a linked list: impl Solution { pub fn is_palindrome(mut head: Option<Box<ListNode>>) -> bool { And ...
Stochastic Sanity's user avatar
2 votes
1 answer
93 views

Below is a Python code for my "Snake Project" (with Turtle and Tkinter). The purpose of this program is to create a chain of turtles, called followers, that follow each other, with the first ...
Number_Pi's user avatar
0 votes
2 answers
79 views

I've been working on Leetcode problem #23: Merge K Sorted Lists: You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one ...
Aarav Shah's user avatar
2 votes
2 answers
107 views

#include <stdio.h> #include <stdlib.h> int main (void) { typedef struct node { int number; struct node *next; }node; // create the pointer to the main ...
Yi Yangna's user avatar
-2 votes
1 answer
56 views

For fun, I tried to create a linked list with lambda functions. I tried this little code as a first step, but my experimentation went short after facing an infinite loop: import itertools stack = ...
Dorian Turba's user avatar
  • 4,041
0 votes
0 answers
23 views

I am seeking clarification on whether 'head' is the head of a linked list or it is an list of type [ListNode]. I think a screenshot of the question will bring more context so let me add it. The ...
Leonard Sangoroh's user avatar
1 vote
1 answer
90 views

So I am having a bit of trouble with this coding project, It is supposed to be a linked list with a bunch of fake students. I can get the first student in correctly, but when the fgets() runs again it ...
Caleb Barone's user avatar
0 votes
1 answer
86 views

Currently doing my self studies/research about the Data Structure and Algorithm. I came with this tutorial. I listen carefully on his lecture. However, when I'm implementing his code to my jupyter ...
Kram R's user avatar
  • 49
-2 votes
1 answer
62 views

I wrote code for a linked list, adding a node. I use VS Code, but when I am want to run the code it's not working. This is my code: package Linked_List; import java.util.*; public class Insertion{ ...
Priyansh Sindhwani's user avatar
-3 votes
1 answer
218 views

I have an algorithm that can be implemented by iteratively modifying a finite integer indexed collection of lists of objects of a certain class X. At every iteration, every object in every list should ...
Ignat Insarov's user avatar
0 votes
2 answers
267 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

1
2 3 4 5
399