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.
List list = new ArrayList(); WORKS
List list = new LinkedList(); DOESNOT WORK
So in this particular case, linkedlist is not better than the array list. I don't know why this is the case. Probably because binary search on a Linked List is not efficient due to traversing using next previous pointers instead of array indices.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Heaps: Find the Running Median
You are viewing a single comment's thread. Return to all comments →
This works the opposite of what the comments say:
List list = new ArrayList(); WORKS List list = new LinkedList(); DOESNOT WORK
So in this particular case, linkedlist is not better than the array list. I don't know why this is the case. Probably because binary search on a Linked List is not efficient due to traversing using next previous pointers instead of array indices.