studenti
Mesto za uspešne studente

Linked Lists

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

 

Linked Lists Linked lists can be thought of from a high level perspective as being a series of nodes. Each node has at least a single pointer to the next node, and in the last node’s case a null pointer representing that there are no more nodes in the linked list. In DSA our implementations of linked lists always maintain head and tail pointers so that insertion at either the head or tail of the list is a constant time operation. Random insertion is excluded from this and will be a linear operation. As such, linked lists in DSA have the following characteristics:
1. Insertion is O(1)
2. Deletion is O(n)
3. Searching is O(n)
Out of the three operations the one that stands out is that of insertion. In DSA we chose to always maintain pointers (or more aptly references) to the node(s) at the head and tail of the linked list and so performing a traditional insertion to either the front or back of the linked list is an O(1) operation. An exception to this rule is performing an insertion before a node that is neither the head nor tail in a singly linked list.

Nastavi sa čitanjem..

Nabavkom greb greb kupona 1000, dopunite vaše kredite i preuzmite gomilu radova.

Ostavite komentar

Morate biti ulogovani da biste komentarisali.