1,844 questions
1
vote
3
answers
113
views
Is this doubly linked list function implemented correctly?
I was watching a youtube video on doubly linked lists in C. One of the functions made for the doubly linked list was an "insert_after_node" function, which as the name suggests inserts a new ...
-2
votes
1
answer
55
views
Print the contents of a Doubly Linked List [closed]
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 ...
1
vote
2
answers
92
views
How to Initialize the tail pointer in a Doubly Linked List for it to not give Segmentation Fault
Now I have created a loop to make 25 nodes for the doubly linked list. By Initializing head pointer as NULL in the main function, now the forward_traversing and show_first functions do work as ...
0
votes
1
answer
110
views
AddLast adds to the head of the doubly circular linked list intead of the tail in Java
I have this homework where I need to create a doubly circular linked list for a Music Player UI. I wrote the addFirst method and it works fine but when I create the addLast method I seem to not be ...
2
votes
3
answers
159
views
Deleting selected element in a doubly linked list [duplicate]
I have written a code on deleting a node by comparing its data from the data given. If equal, it deletes the node. My problem is that my code will delete every node in the list except the last node, I ...
0
votes
0
answers
98
views
Why am i getting a segmentation fault in a code for checking palindrome using linked list?
The statements for my questions are:
Write a program to determine whether a linked list is a palindrome or not.
**Input Format:
**
The first line contains integers separated by spaces representing the ...
0
votes
1
answer
188
views
Why does my double-linked list display the numbers in reverse order, except for the first added number?
I wrote this code where you can add or remove numbers from a list, and then display the list. The problem is: it displays the numbers in reverse order, except for the first added number.
program ...
0
votes
1
answer
86
views
Reversing a Doubly Linked List in Rust
I have the following implementation for a Doubly Linked List ->
struct Node<T> {
value: T,
next: Option<Rc<RefCell<Node<T>>>>,
prev: Option<Weak<...
0
votes
1
answer
266
views
AttributeError: 'NoneType' object has no attribute 'next'; looked through multiple articles with the same error
I created a simple Doubly Linked List, with an append method and a str() that is supposed to return the elements present in the list.
Here is the code;
class Node:
def __init__(self,val):
...
-3
votes
1
answer
94
views
Doubly-Linked Lists in Java [closed]
I am a freshman in IT and we did a quiz about linked lists and one of the questions was:
Linked List. Show the resulting list (redraw) after the following statements are executed.
So we have a doubly ...
-1
votes
1
answer
74
views
Segmentation fault in overloaded input operator in CPP
I am trying to import a book by prompting the user to provide its details in the command line one after another. For that I am using an overloaded input operator but when trying it out it results in a ...
0
votes
1
answer
141
views
Doubly Linked list Insertion
I made a program to insert a element in doubly linked list given below(ignore create and display functions
Which was working perfectly right till it found the index to be inserted is 5 ,where it fails ...
0
votes
1
answer
120
views
Managing Hospital Data with C# and Doubly Linked Circular Lists: Issue with Patient Information Output Display
This code aims to create a hospital data management application using doubly linked circular lists. It can be divided into two main parts:
Classes:
The Patient, Medicine, Doctor, and Disease classes ...
0
votes
1
answer
329
views
How to create an efficient immutable tree, with parent pointers
I'm constructing a "scenegraph", which is a hierarchical data structure of Shape nodes (e.g. sphere, cube, mesh, etc. not shown in example code). A Shape can own zero or more child Shape ...
0
votes
1
answer
39
views
How to fix error in doubleLinkedList java code where when adjacent nodes are inputted to switch the second node is twice, removing the first node
I am making a project right now to practice double linked lists and I have been working on a method in my double linked lists class which switches node locations. It works fine when trying to switch ...
1
vote
2
answers
62
views
Print Backward not working Python doubly linked list
I am learning linked list and I'm creating doubly linked list. My print backward is not working as intended. For better Information I will highlight the print backward function.
Print Backward
class ...
2
votes
1
answer
280
views
Do I have to remove all references to an object using std::shared_ptr
So, as a hundreds of thousands of people before me, I am implementing a doubly linked list in С++.
Here's a Node and List struct:
struct Node {
std::shared_ptr<Node> prev, next;
int data;...
1
vote
0
answers
91
views
Problems with Big O Notation
I created two dictionaries, one using doubly linked lists and another using binary search trees, both with some basic functions. I want to estimate the Big O notation for both dictionaries and compare ...
0
votes
0
answers
54
views
How to use void pointers/typecasting for implementation of a doubly_linked_list class
I have an assignment in which I have to implement a doubly linked list ADT. I do not have issues with that, I created something like this:
class DoublyLinkedList{
struct Node{
int value;
...
2
votes
1
answer
87
views
Is it possible to find the number of elements in a circular doubly linked list? [closed]
We have a circular doubly linked list with several elements. Every element has a link to the next element, a link to the previous element and a boolean value (true or false).
Four operations are ...
-2
votes
1
answer
75
views
How do I add spaces between elements in a doubly linked list when concentrating them into a string in Java?
I'm creating a toString() function that should return a String created by concatenating each Nodes toString(). A single space: ‘ ’ should be inserted between each Nodes toString(). No trailing space ...
1
vote
2
answers
58
views
What am I doing wrong in my Java implementation of a doubly linked list? [closed]
I am trying to create a doubly linked list in java and just need a little guidance as too where I am going wrong.I also wanted to be able to set a capacity for the list as well.
This is what I have so ...
-1
votes
1
answer
58
views
Double linked list improvements [closed]
I'm trying to improve my double linked list API.
int ll_create(linked_list_p list, void (*print_data)(uint8_t)) {
if (list == NULL) {
list = calloc(1, sizeof(linked_list_p));
...
-1
votes
1
answer
77
views
-SOLVED- How to add List Comprehension and 'for in' loop for Doubly Linked List
I have created a python class for doubly linked list. It looks like this:
from tabulate import tabulate
class Node:
def __init__(self, value):
self.data = value
self.next = None # ...
1
vote
1
answer
50
views
Searching for string input using a function bool deleteAcc(const string name1) in doubly linkedlist in C++98?
All my other functions of my doubly linked list which consist of Account class and Node class are all working except this last function.
The function bool deleteAcc(string name) will take as it’s ...