stack implement using linklist we should also use head as top and pop it with o(1) ?
Stack Implementation
Hello @khemchandrs,
Yes, if you want to pop and push elements in O(1) time complexity.
You can do this by inserting elements at head instead of inserting them at tail.
For this approach, the head and top will point to the same node.
Hope, this would help.
Give a like if you are satisfied.