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.
I wrote a code whose complexity is approximately O(M*log(N)) in avarage case.(in best case O(M)). When integers of B arrays become small number such as 15-20, complexity approach O(N*M) which is worst case. What is the trick of this question? Make worst case and avarage case complexity linearithmic time or better?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Queries
You are viewing a single comment's thread. Return to all comments →
I wrote a code whose complexity is approximately O(M*log(N)) in avarage case.(in best case O(M)). When integers of B arrays become small number such as 15-20, complexity approach O(N*M) which is worst case. What is the trick of this question? Make worst case and avarage case complexity linearithmic time or better?