------------------------------------------------------------------------------
-- --
--- GNAT RUNTIME COMPONENTS --
+-- GNAT RUN-TIME COMPONENTS --
-- --
-- G N A T . H E A P _ S O R T --
-- --
-- S p e c --
-- --
--- Copyright (C) 1995-2002 Ada Core Technologies, Inc. --
+-- Copyright (C) 1995-2006, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
--- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
--- MA 02111-1307, USA. --
+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
+-- Boston, MA 02110-1301, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- subprogram parameters, so that it can be used with different types with
-- shared sorting code.
--- See also GNAT.Heap_Sort_G and GNAT.Heap_Sort_A. These are older versions
--- of this routine. In some cases GNAT.Heap_Sort_G may be a little faster
--- than GNAT.Heap_Sort, at the expense of generic code duplication and a
--- less convenient interface. The generic version also has the advantage
--- of being Pure, while this unit can only be Preelaborate.
-
-- This heapsort algorithm uses approximately N*log(N) compares in the
-- worst case and is in place with no additional storage required. See
-- the body for exact details of the algorithm used.
+-- See also GNAT.Heap_Sort_G which is a generic version that will be faster
+-- since the overhead of the indirect calls is avoided, at the expense of
+-- generic code duplication and less convenient interface. The generic version
+-- also has the advantage of being Pure, while this unit can only be
+-- Preelaborate, because of the access types.
+
+-- Note: GNAT.Heap_Sort replaces and obsoletes GNAT.Heap_Sort_A, which is
+-- retained in the GNAT library for backwards compatibility.
+
package GNAT.Heap_Sort is
-pragma Preelaborate (Heap_Sort);
+ pragma Pure;
-- The data to be sorted is assumed to be indexed by integer values
-- from 1 to N, where N is the number of items to be sorted.