Given a singly linked list of size
what is the time complexity of finding the 10th element form the front and the 10th element from the end respectively?
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
From the front we traverse 1 0 node which is O ( 1 )
But 1 0 th element from the back means ( n − 1 0 + 1 ) th element from the front which is O ( n )
The thing to understand is that the big-oh is a measure of the asymptotic growth.