Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^6: How to check lines that start with the same word then delete one of them

by rsFalse (Hermit)
on Apr 10, 2020 at 15:13 UTC ( #11115323=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11115323]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-11-30 22:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?