http://qs321.pair.com?node_id=11115323


in reply to Re^5: How to check lines that start with the same word then delete one of them
in thread How to check lines that start with the same word then delete one of them

I think your solution works in O(n*log n), because searching an item in a hash takes log n. Am I right? Still much much faster that O(n*n) :)
  • Comment on Re^6: How to check lines that start with the same word then delete one of them

Replies are listed 'Best First'.
Re^7: How to check lines that start with the same word then delete one of them
by Laurent_R (Canon) on Apr 10, 2020 at 15:42 UTC
    No, a hash lookup is usually O(1), it does take some time, sure, but the time it takes does not depend (generally) on the hash size.