Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by andromeduck

2 years ago

O(log n) vs O(1)

3 comments

andromeduck

Reply

ryanschaefer  2 years ago

Is there a way to keep a list with changing values sorted in real time in order to use a log n search algorithm?

  • throw_pm23  2 years ago

    Yes, a binary search tree that is dynamically balanced, for example red-black or avl.

  • andromeduck  2 years ago

    It's log n either way.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities