🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5897

Re: object oriented design decision

#5897
From: Peter Schachte
Date: Wed, 23 Nov 1988 21:24
27 lines
1815 bytes
In article <9861@watdragon.waterloo.edu> akwright@watdragon.waterloo.edu (Andrew K. Wright) writes:
...
>This says "sort" operates on arrays of any type and any number of elements,
>so long as the function ">" is defined between the elements.
>
>This is a simplified example; a general sort would not require the
>data structure to be an array.  Sorting linked lists may be equally
>desirable, and requires sort to be further generalized to require
>that swap (or := and a temporary constructor) exist.

But that's not a good idea, efficiency-wise.  You might want to use
Quicksort to sort arrays, but you sure wouldn't want to use it for
lists.  You'd probably use a merge sort.

Take it even a step farther.  If the type of element you're sorting is
small, and comparison is cheap (e.g., sorting integers) you'd want to
use quicksort.  If the number if distinct keys is small, you might use
a radix sort.  If the data to be sorted will not fit in memory, maybe
you'd use a heapsort to get sorted pieces followed by merge passes.

If you're talking about real-world constraints that make
single-inheritance systems painful, there are also real world
constraints that make a polymorphic system painful, too.  Nothing's
perfect.
-Peter Schachte				"Clean water?  I'm for clean water."
pds@quintus.uucp				-George Bush
..!sun!quintus!pds
Technical Details
Message-ID: <734@quintus.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!quintus!pds
References: <4086@enea.se> <11522@cup.portal.com> <9861@watdragon.waterloo.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!seismo!sundc!pitstop!sun!quintus!pds
From: pds@quintus.uucp (Peter Schachte)
Newsgroups: comp.lang.misc
Subject: Re: object oriented design decision
Message-ID: <734@quintus.UUCP>
Date: 23 Nov 88 21:24:28 GMT
References: <4086@enea.se> <11522@cup.portal.com> <9861@watdragon.waterloo.edu>
Sender: news@quintus.UUCP
Reply-To: pds@quintus.UUCP (Peter Schachte)
Organization: Quintus Computer Systems, Inc.
Lines: 27