Блог пользователя krillin

Автор krillin, история, 4 недели назад, По-английски

I was recently doing some problems on two pointers when I saw some really clever ways to use two pointers on some problems which would otherwise seem impossible to solve faster than O(n^2) complexity. So, that's when I got this thought in my mind, how do we "know" that a particular complexity is the best possible for a particular problem and that there is not a better solution possible using some clever technique that we just haven't thought of yet. For example, let's say that there is some problem which could be solved in O(n^5) time. How do we know that there isn't any n^4 solution that we just haven't discovered yet. Can we just look at any problem and surely say that yes, it cannot have a solution which is better than this particular time complexity? I would be glad if anyone could provide some insight on this topic.

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by krillin (previous revision, new revision, compare).

»
4 недели назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

it can be proved yes though maybe not always. the one example i can think of is sorting algorithms, its provable that you cannot get better than O(nlogn) for comparison based sorting algorithms

»
4 недели назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

What i often find useful is to try to prove that no faster solution exists, and during the process i figure out why i am wrong, which gives me a tighter bound and i re-apply the same technique again. Ofcourse, writing such proofs is not a simple process, and there are lot of unsolved problems which just ask for the lower bound proofs on problems.

»
4 недели назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

Most of the time you can't.