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.
My algorithm has insertion time O(lg(m)) and querying time O(lg(n)lg(m)) where n is the amount of insertions and m is the maximum value of an insertion (so lg(m) = 15).
It is fast enough on all cases except case #10. On cases #1-9 it takes over 3 seconds each.
I would like to know if I have optimal time complexity, and need to focus on cutting edges, or if I can improve on the time complexity.
If I do have optimal time complexity, and just need to cut edges, might it be a solution to switch programming language? Because I made it in Java and I know there are faster languages out there.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
XOR key
You are viewing a single comment's thread. Return to all comments →
My algorithm has insertion time O(lg(m)) and querying time O(lg(n)lg(m)) where n is the amount of insertions and m is the maximum value of an insertion (so lg(m) = 15).
It is fast enough on all cases except case #10. On cases #1-9 it takes over 3 seconds each.
I would like to know if I have optimal time complexity, and need to focus on cutting edges, or if I can improve on the time complexity.
If I do have optimal time complexity, and just need to cut edges, might it be a solution to switch programming language? Because I made it in Java and I know there are faster languages out there.