GeeksforGeeks » Miscellaneous
time complexities in Queue
(2 posts)-
What are the time complexities following operations in Queue. Consider Linked List representation
1) insert()
2) remove()
3) search()What are the complexities for Stack?
-
Following are the time complexities, assuming that you have both pointers front and rear in the Linked List implementation.
1) insert(): O(1)
2) remove(): O(1)
3) search(): O(n)Following are the time complexities for stack, assuming that you have only one pointer top.
1) insert(): O(1)
2) remove(): O(1)
3) search(): O(n)
Reply
You must log in to post.