Skip to main content

All Questions

-2 votes
1 answer
57 views

why the method for adding node in a doubly linked list is different from singly linked list in c++?

here is a cpp program for creating a singly linked list : #include <iostream> `using namespace std ; // starting with linked list class node { public : int data ; node * ...
sam's user avatar
  • 7
0 votes
0 answers
30 views

I understand that there is no need for a variable to store the prev node in the doubly linked list

so I use cur->llink when I search the node to express previous node, and delete the node. Suppose erase a node in the middle. cur=h->first; cur->llink=NULL; while(cur->rlink!=NULL) { ...
jeongmin99's user avatar
0 votes
2 answers
50 views

I tried solving reverse linkedlist on my own way. please spot the problem reversing the linkedlist

Hi everyone Can you tell me why this code not working for reversing linkedlist I tried my own way to solve but don't get what am I doing wrong def reverselist(self): temp=self.start cur=None ...
usman's user avatar
  • 13
0 votes
1 answer
52 views

How Nodes are pointed/referenced in linkedlist

I feel really confused about how nodes are referenced to each other in linkedlist. Supposed we have code like this: NodeA: 1->2->3; NodeB: 6->7->8; ListNode NodeC = NodeA; IF WE DO: ...
TheLegend27's user avatar
0 votes
0 answers
217 views

How ListNode && dummyNode works?

Hi I have difficulty on understanding how ListNode && dummy node works. Suppose we are given the head of the list. When we declare ListNode dummy = head, and we are not touching dummy node in ...
TheLegend27's user avatar
-2 votes
1 answer
144 views

Which data structure is suitable for efficient searching and minimum possible memory?

I want to develop an application to maintain the inventory of different products. Products are divided into different categories. The number of categories are fixed but products in each category can ...
Adnan's user avatar
  • 165
1 vote
4 answers
1k views

Remove the same elements from a linked list

I want to remove the required values(int) in a linked list. For example, {3,1,2,3,3}. I use remove(int 3), then it should be {1,2}. Can you help me, my code can just remove the 3 in the index 0, but I ...
Jimmy Tan's user avatar
0 votes
2 answers
656 views

Changing a singly linked list to a doubly linked list

I created a singly linked list function and my professor said for extra credit we can change it into a doubly linked list. I read a few things such as adding a prev_node function such as this. class ...
Cooper's user avatar
  • 123
0 votes
2 answers
131 views

Is it necessary to isolate the node, when deleting from the middle of a Linked List?

Do we just make the previous node point to the next. prev.next = next; return current; or isolate the node prev.next = next; current.next = null; return current; As are still able to traverse ...
Arun's user avatar
  • 1
-4 votes
1 answer
719 views

How can we simulate/implement an array using singly and doubly linked lists? [closed]

I have implemented singly liked list and doubly linked list in Java, now my teacher asked me to implement array using singly and doubly linked list (In Java). I came across a few solutions on how to ...
Malangi's user avatar