Category : Pascal Source Code
Archive   : MRGSORT.ZIP
Filename : MRGSORT.DOC

 
Output of file : MRGSORT.DOC contained in archive : MRGSORT.ZIP
UNIT mrgsort;
(* By C.B. Falconer, public domain. This is based on a description *)
(* in Sedgewicks 'Algorithms', but modified for isolation to a TP *)
(* unit, with a generalized linkage to the items to sort. *)

(* Since the 'info' field of a linknode is never used here, the *)
(* actual record may be designed as the application demands, so *)
(* long as the FIRST item in it is the 'next' pointer. Care must *)
(* then be taken not to modify the info field of 'null'. *)

(* The user defined 'greater' function will receive whatever type *)
(* of pointer is passed in to sort, and never the null pointer. *)

(* The list to be sorted must be terminated with a 'next' that *)
(* contains the value 'null', and it must be the null defined here. *)

INTERFACE

TYPE
greaterf = FUNCTION(thing, than : pointer) : boolean;

VAR
null : pointer; (* used as NIL substitute for end marks *)

FUNCTION sort(root : pointer; greater : greaterf) : pointer;
(* This provides a logical level for passing in the 'greater' proc. *)
(* note that these procedures do not use the header link, i.e. the *)
(* pointers they receive carry actual list data. The pointers will *)
(* later be defined as holding only the next and an 'info' pointer. *)
(* The info pointer will not be used here, so can be of any type. *)

IMPLEMENTATION
j

  3 Responses to “Category : Pascal Source Code
Archive   : MRGSORT.ZIP
Filename : MRGSORT.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/