notesonly.in

One notebook for every subject — open it anywhere.

Log in

Arrays and linked lists (singly, doubly, circular)

Data Structures · Engineering

Study notes

Insert 25 at the head of a linked list: create node with data 25, set its next to current head, update head pointer. Three pointer operations, O(1), no shifting. In an array of 1000 elements, the same insert shifts 1000 elements, O(n). This is why lists win for frequent insertions.

← Back to topics for Engineering