comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R.Carter" <spam.jrcarter.not@spam.acm.org.not>
Subject: Re: String Buffer
Date: Thu, 2 Dec 2021 22:06:09 +0100	[thread overview]
Message-ID: <sobcg4$tc4$1@dont-email.me> (raw)
In-Reply-To: <sob9gf$5mh$1@gioia.aioe.org>

On 2021-12-02 21:15, Dmitry A. Kazakov wrote:
> 
> It is true only to a certain degree. When comparing algorithms it is valid to 
> claim inefficiency without any context if computational complexity sufficiently 
> differs.
> 
> For example, an O(N) algorithm is unquestionably inefficient comparing to O(log 
> N) one. I leave marginal cases of very small N.

This is false. If you have the O(N) algorithm and it meets your requirements, 
then using it is more efficient than implementing the O(log N) algorithm. If you 
have both and the O(N) algorithm meets your requirements, the effort to get your 
data into a form where you can apply the O(log N) algorithm may still outweigh 
the time difference.

As for "very small N", I have worked on systems where linear search was 
efficient for sequences of 100,000 items.

The only thing you can meaningfully say about such algorithms is that one is 
O(N) and the other O(log N). Both have their uses.

Unbounded_String is needed far less than many people think, but there are 
application domains where it is much easier to achieve correctness and clarity 
with a variable-length string abstraction than without. Blanket statements about 
"efficiency" are dangerous for those working in such domains.

-- 
Jeff Carter
"After fifteen minutes I wanted to marry her, and
after a half hour I completely gave up the idea of
snatching her purse."
Take the Money and Run
136

  reply	other threads:[~2021-12-02 21:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02 18:17 String Buffer Kevin Chadwick
2021-12-02 19:56 ` Jeffrey R.Carter
2021-12-02 20:15   ` Dmitry A. Kazakov
2021-12-02 21:06     ` Jeffrey R.Carter [this message]
2021-12-02 21:45       ` Dmitry A. Kazakov
2021-12-03  0:49         ` Kevin Chadwick
2021-12-03  5:25       ` Randy Brukardt
2021-12-03  8:31   ` ldries46
2021-12-02 20:51 ` Simon Wright
2021-12-03  8:11 ` Vadim Godunko
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox