CS301 GDB SOLUTION
Solution:
A doubly linked list is appropriate for a hospital. A doubly
linked list is traversed in both directions. Because traversal in a doubly
linked list is based on previous and next node linkages.
Insertion and deletion in a doubly linked list become more
difficult at locations 1 and 0.
Because both traversals are possible in a doubly linked
list, we can access items in it more efficiently than elements in a singly
linked list.
In comparison, the complexity of insertion and deletion in a
singly linked list at positions 0 and n is n.
As a result, whenever there are no memory limits and we need
to search, we always utilize a doubly linked list.
When memory is limited, we recommend a simply linked list.
In a doubly linked list, we have two pointers, one for the
next node and one for the previous node. As a consequence, searching is a piece
of cake.
A double linked list is preferable if we need high
performance, have no memory limits, and wish to search.
Comments
Post a Comment
Please feel free to share your ideas.