Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: Data structure challenge (amortized)

by sleepingsquirrel (Chaplain)
on Mar 18, 2004 at 00:01 UTC ( [id://337561]=note: print w/replies, xml ) Need Help??


in reply to Re: Re^2: Data structure challenge (amortized)
in thread Data structure challenge

As long as we're only talking big-O notation, I think that that O(n) initialization is a wash. Inserting n items at O(1) is O(n). And O(n) (for initialization) + O(n) (for n insertions) = O(n).
  • Comment on Re^4: Data structure challenge (amortized)

Replies are listed 'Best First'.
Re: Data structure challenge (amortized)
by Abigail-II (Bishop) on Mar 18, 2004 at 00:15 UTC
    I'm not sure what you mean. Note that if you use an array, the array size is U. And, yes, n insertions, each taking constant time is O (n). However, initializing all elements of an array of size U takes Θ (U). But it's not given that U = O (n). There might only be O (sqrt (U)) insertions.

    Abigail

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2024-04-23 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found