radixsort.3 (59460) | radixsort.3 (79754) |
---|---|
1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)radixsort.3 8.2 (Berkeley) 1/27/94 | 1.\" Copyright (c) 1990, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)radixsort.3 8.2 (Berkeley) 1/27/94 |
33.\" $FreeBSD: head/lib/libc/stdlib/radixsort.3 59460 2000-04-21 09:42:15Z phantom $ | 33.\" $FreeBSD: head/lib/libc/stdlib/radixsort.3 79754 2001-07-15 07:53:42Z dd $ |
34.\" 35.Dd January 27, 1994 36.Dt RADIXSORT 3 37.Os 38.Sh NAME 39.Nm radixsort 40.Nd radix sort 41.Sh LIBRARY --- 19 unchanged lines hidden (view full) --- 61The byte strings may contain any values; the end of each string 62is denoted by the user-specified value 63.Fa endbyte . 64.Pp 65Applications may specify a sort order by providing the 66.Fa table 67argument. 68If | 34.\" 35.Dd January 27, 1994 36.Dt RADIXSORT 3 37.Os 38.Sh NAME 39.Nm radixsort 40.Nd radix sort 41.Sh LIBRARY --- 19 unchanged lines hidden (view full) --- 61The byte strings may contain any values; the end of each string 62is denoted by the user-specified value 63.Fa endbyte . 64.Pp 65Applications may specify a sort order by providing the 66.Fa table 67argument. 68If |
69.Pf non- Dv NULL , | 69.Pf non- Dv NULL , |
70.Fa table 71must reference an array of 72.Dv UCHAR_MAX 73+ 1 bytes which contains the sort 74weight of each possible byte value. 75The end-of-string byte must have a sort weight of 0 or 255 76(for sorting in reverse order). 77More than one byte may have the same sort weight. --- 26 unchanged lines hidden (view full) --- 104.Fn radixsort 105function is not stable, but uses no additional memory. 106.Pp 107These functions are variants of most-significant-byte radix sorting; in 108particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise 10. 109They take linear time relative to the number of bytes in the strings. 110.Sh RETURN VALUES 111Upon successful completion 0 is returned. | 70.Fa table 71must reference an array of 72.Dv UCHAR_MAX 73+ 1 bytes which contains the sort 74weight of each possible byte value. 75The end-of-string byte must have a sort weight of 0 or 255 76(for sorting in reverse order). 77More than one byte may have the same sort weight. --- 26 unchanged lines hidden (view full) --- 104.Fn radixsort 105function is not stable, but uses no additional memory. 106.Pp 107These functions are variants of most-significant-byte radix sorting; in 108particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise 10. 109They take linear time relative to the number of bytes in the strings. 110.Sh RETURN VALUES 111Upon successful completion 0 is returned. |
112Otherwise, \-1 is returned and the global variable | 112Otherwise, \-1 is returned and the global variable |
113.Va errno 114is set to indicate the error. 115.Sh ERRORS 116.Bl -tag -width Er 117.It Bq Er EINVAL 118The value of the 119.Fa endbyte 120element of --- 44 unchanged lines hidden --- | 113.Va errno 114is set to indicate the error. 115.Sh ERRORS 116.Bl -tag -width Er 117.It Bq Er EINVAL 118The value of the 119.Fa endbyte 120element of --- 44 unchanged lines hidden --- |