Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: Anyone ever used vector ? Date: Tue, 17 May 2022 05:37:50 -0700 Organization: A noiseless patient Spider Lines: 17 Message-ID: <86bkvw2v35.fsf@linuxsc.com> References: <423b2f62-20d0-4578-a047-a4c2b03d917fn@googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="0161277cd888cf27dddddc87a0dfb7f9"; logging-data="11740"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+HTrOIQuYTEzq77zSd0DSWXYDneb4Dlm0=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:j9G0u97Pr6/xkSHRQd1DPgIVoIk= sha1:W1Ln8zwdmal18gVHiuwlRMrCHYc= Xref: csiph.com comp.lang.c++:84149 Juha Nieminen writes: > James Kuyper wrote: > >> Whenever the standard specifies the complexity of an operation, an >> implementation that has a lower complexity is always allowed. In >> particular, if the standard specifies O(N), an implementation that >> sometimes takes O(1) time, and sometimes takes O(N) meets that >> specification. An implementation that took O(N^2) time would not. > > One has to be quite careful with the wording used, though. > > "at most O(n)", "on average O(n)" and "amortized O(n)" can mean > quite different things. Because James is talking about what is said in the C++ standard, what "O(n)" means is the same as what is meant in the standard.