answersLogoWhite

0


Best Answer

It depends on whether or not you have a head node. If you do, then it is not a special case. If you don't, then it is, and you need to be able to update the head pointer.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Is deleting the only node in linked list a special case?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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


An algorithm of deleting linked list?

To delete a linked list walk through the list and delete the memory allocated to each element, remembering the next element address, and then iterating or recursing the process using the next element address, until the next element address is null.


What is the advantage of doubly linked list over Doubly linked list?

A doubly linked list can be traversed in both directions (forward and backward). A singly linked list can only be traversed in one direction. A node on a doubly linked list may be deleted with little trouble, since we have pointers to the previous and next nodes. A node on a singly linked list cannot be removed unless we have the pointer to its predecessor. On the flip side however, a doubly linked list needs more operations while inserting or deleting and it needs more space (to store the extra pointer).


How the pointer used in the linked list?

The pointer in linked list is used for traversing through the elements of the linked list. In a singly linked list, only a next pointer exits. So this pointer can be used for traversing only in one direction in the list. In case of a doubly linked list, a next and previous pointer exits. These pointers are used for traversing in both direction in the list.


What is best and worst case of time complexity and space complexity of insert and delete operation in singly linked list doubly linked list?

When inserting or extracting at the end of a singly-linked list or at the beginning or end of a doubly-linked list, the complexity is constant time. Inserting or extracting in the middle of a list has linear complexity, with best case O(1) when the insertion or extraction point is already known in advance and a worst case of O(n) when it is not.

Related questions

what are the various operations in linked list which can be performed on linked list?

Some common operations that can be performed on a linked list include inserting a node, deleting a node, searching for a specific node, traversing the list, and updating a node's value. Other operations may include reversing the list, merging two lists, sorting the list, and finding the length of the list.


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


An algorithm of deleting linked list?

To delete a linked list walk through the list and delete the memory allocated to each element, remembering the next element address, and then iterating or recursing the process using the next element address, until the next element address is null.


What is the advantage of doubly linked list over Doubly linked list?

A doubly linked list can be traversed in both directions (forward and backward). A singly linked list can only be traversed in one direction. A node on a doubly linked list may be deleted with little trouble, since we have pointers to the previous and next nodes. A node on a singly linked list cannot be removed unless we have the pointer to its predecessor. On the flip side however, a doubly linked list needs more operations while inserting or deleting and it needs more space (to store the extra pointer).


How the pointer used in the linked list?

The pointer in linked list is used for traversing through the elements of the linked list. In a singly linked list, only a next pointer exits. So this pointer can be used for traversing only in one direction in the list. In case of a doubly linked list, a next and previous pointer exits. These pointers are used for traversing in both direction in the list.


What is best and worst case of time complexity and space complexity of insert and delete operation in singly linked list doubly linked list?

When inserting or extracting at the end of a singly-linked list or at the beginning or end of a doubly-linked list, the complexity is constant time. Inserting or extracting in the middle of a list has linear complexity, with best case O(1) when the insertion or extraction point is already known in advance and a worst case of O(n) when it is not.


Convert single linked list to double linked list?

You copy a singly linked list into a doubly linked list by iterating over the singly linked list and, for each element, calling the doubly linked list insert function.


What is advantage linked list?

Adding or deleting nodes is faster than using an array, however, accessing an individual node requires that you traverse the list starting at the head, which is far slower than an array where you can simply calculate the offset.


What are the real time applications of linked lists?

For understanding basic concept train would be the best example for linked lists for example adding and deleting nodes is how we add and remove compartments in a train Real time application where linked list is really used is maintaining relational databases. in database tables may be associated with each other so for linking it to each other linked list data structure is the best choice


Which is the easy insertion operator single linked-list or double-linked list?

It is easier to insert into a singly linked list.


What is the difference between linked list and Ordinary list?

A list is an abstract data structure, usually defined as an ordered collection of data. A linked list refers to a specific implementation of a list in which each element in the list is connected (linked) to the next element.


Traversing in Doubly Linked List is faster then Singly Linked List?

Traversing a doubly linked list is generally faster than traversing a singly linked list, but the speedup depends on how you do the traversal:Traversing from first to last node: No difference.Random access: Doubly linked list is faster, the difference is a fixed factor. (Like twice as fast. Which makes it still very slow for random access compared to arrays.)Reverse order: Doubly linked list is just as fast traversing "backwards" as "forwards", while a singly linked list traversing in reverse order needs to traverse the entire list once for every element in the list - it is a LOT slower. (Time complexity O(n) for doubly linked list, O(n*n) for singly linked, if you are familiar with the notation.)If you are talking about the computer science "big O notation", doubly linked and singly liked lists are the same. This is because the Big O notation ignores fixed factors and only looks at how time increases with the length of the list, and in this respect the two are the same. (Except for the special case of traversing the list in reverse order. Even here a singly linked list could do it in O(n) time - same as a doubly linked list - by reversing the list (O(n)) before traversing it (O(n)) for a total time of 2*O(n), which by the rules of Big O is the same as O(n).)