We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Big-oh by definition is bounding the worst case.
The worst case is when they are both the same length, i.e. when N and M are both equal to N.
You get O(2N) in that case. i.e. O(N).
All im saying is rudaliszkas' "correction" is wrong, in the sense that it is saying exactly what you had originally, only your original answer is how it is always expressed in big-oh.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
Big-oh by definition is bounding the worst case. The worst case is when they are both the same length, i.e. when N and M are both equal to N.
You get O(2N) in that case. i.e. O(N).
All im saying is rudaliszkas' "correction" is wrong, in the sense that it is saying exactly what you had originally, only your original answer is how it is always expressed in big-oh.