is. O(1) as per i read in some of the sof answers.
If we implement pop in singly linked list it will be O(N) - (for assigning a new tail )
So pop will perform better in array than a singly linkedlist.
Is it right ?
Ok... I tested it myself as i should have instead of asking here... With 10 same elements in list and array. Singlylinked list took. 0.138ms Array took. 0.007ms To pop off an element. Thanks
Обсуждают сегодня