answersLogoWhite

0

Implement dequeue using doubly linked list?

Updated: 8/18/2019
User Avatar

Wiki User

14y ago

Best Answer

if (this->next) this->next->prev= this->prev;

else list->last= this->prev;

if (this->prev) this->prev->next= this->next;

else list->first= this->next;

free (this);

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Implement dequeue using doubly linked list?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can implement round robin sceduler in java using circular doubly linked list?

I'm sorry brother


How do you implement a doubly linked list by using singly linked list?

To implement a doubly linked list using a singly linked list, you can create two nodes in each element of the singly linked list - one for the next element and another for the previous element. This way, each node will have access to both its previous and next nodes, effectively creating a doubly linked list structure using a singly linked list implementation.


C program to implement deque using circular linked list?

You'll need to use a doubly-linked circular list, since otherwise when you pop off the tail element you'll need to whizz all the way round the list to find its predecessor. See the links section for an implementation of a doubly-linked circular list.


How do you write a Java program to implement weighted queue using circular doubly linked list?

Add weights to the elements of the queue and use an algorithm to sort the queue every time an element is added.


Is it possible to implement stack and queues using linkes list?

Yes it is possible to implement stack and queue using linked list


How do you implement a doubly linked list using only one reference value instead of the usual next and previous references?

store the exor of the previous node address and next node address in each node of single linked list .further exor the nodes to proceed forward or backward as necessary


Which function removes last element in a list?

If you are using the doubly-linked list from the STL library, then the function call:name_of_list.push_back();should delete the last element.


Explain any two advantages using Single linked list over Doubly linked list and vice-versa?

Advantages of single linked list: # Decrease in storage space per linked list node # Simpler implementation Advantages of double linked list # Decrease in work when accessing a random node # Decrease in work when inserting or deleting a node


What is a singly linked linear list?

A singly linked list is a linked list which only provides links in "one direction". Using a metaphor, a singly linked list is a one way street, while a doubly linked list is a two way street. Once you move forward in a singly linked list, there is no way to go backwards unless you kept your reference/pointer from before. A singly linked list would look like this: start ----> node1---->node2---->node3 ----> NULL You will see that node2 only has a link forward to node3 - it does not have a link backwards to node1, even though node1 has a link forwards to node2. To prevent us from permanently losing access to portions of the linked list, we generally keep a reference/pointer to "start". A doubly linked list would have twice the number of pointers/references as a singly linked list - making it very inefficient to store small datatypes. On the other hand, it would be possible to move both forwards and backwards with a doubly linked list because you have links pointing both forwards and backwards.


How do you implement stack without array?

Stacks are often implemented using the same node structure as a linked list.


Can you get pregnant using a condom the day after your period ends?

Doubly unlikely.


Can you make a sentence using the verb implement?

He decided to implement his plan.