diff options
Diffstat (limited to 'src/lib/libc/stdlib/radixsort.3')
-rw-r--r-- | src/lib/libc/stdlib/radixsort.3 | 151 |
1 files changed, 0 insertions, 151 deletions
diff --git a/src/lib/libc/stdlib/radixsort.3 b/src/lib/libc/stdlib/radixsort.3 deleted file mode 100644 index 7290142a9c..0000000000 --- a/src/lib/libc/stdlib/radixsort.3 +++ /dev/null | |||
@@ -1,151 +0,0 @@ | |||
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. | ||
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | ||
10 | .\" notice, this list of conditions and the following disclaimer in the | ||
11 | .\" documentation and/or other materials provided with the distribution. | ||
12 | .\" 3. Neither the name of the University nor the names of its contributors | ||
13 | .\" may be used to endorse or promote products derived from this software | ||
14 | .\" without specific prior written permission. | ||
15 | .\" | ||
16 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | ||
17 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
18 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
19 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | ||
20 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
21 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
22 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
23 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
24 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
25 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
26 | .\" SUCH DAMAGE. | ||
27 | .\" | ||
28 | .\" $OpenBSD: radixsort.3,v 1.14 2022/08/04 06:20:24 jsg Exp $ | ||
29 | .\" | ||
30 | .Dd $Mdocdate: August 4 2022 $ | ||
31 | .Dt RADIXSORT 3 | ||
32 | .Os | ||
33 | .Sh NAME | ||
34 | .Nm radixsort , | ||
35 | .Nm sradixsort | ||
36 | .Nd radix sort | ||
37 | .Sh SYNOPSIS | ||
38 | .In limits.h | ||
39 | .In stdlib.h | ||
40 | .Ft int | ||
41 | .Fn radixsort "const u_char **base" "int nmemb" "const u_char *table" "u_int endbyte" | ||
42 | .Ft int | ||
43 | .Fn sradixsort "const u_char **base" "int nmemb" "const u_char *table" "u_int endbyte" | ||
44 | .Sh DESCRIPTION | ||
45 | The | ||
46 | .Fn radixsort | ||
47 | and | ||
48 | .Fn sradixsort | ||
49 | functions are implementations of radix sort. | ||
50 | .Pp | ||
51 | These functions sort an array of | ||
52 | .Fa nmemb | ||
53 | pointers to byte strings. | ||
54 | The initial member is referenced by | ||
55 | .Fa base . | ||
56 | The byte strings may contain any values; the end of each string | ||
57 | is denoted by the user-specified value | ||
58 | .Fa endbyte . | ||
59 | .Pp | ||
60 | Applications may specify a sort order by providing the | ||
61 | .Fa table | ||
62 | argument. | ||
63 | If non-null, | ||
64 | .Fa table | ||
65 | must reference an array of | ||
66 | .Dv UCHAR_MAX | ||
67 | + 1 bytes which contains the sort weight of each possible byte value. | ||
68 | The end-of-string byte must have a sort weight of 0 or 255 | ||
69 | (for sorting in reverse order). | ||
70 | More than one byte may have the same sort weight. | ||
71 | The | ||
72 | .Fa table | ||
73 | argument is useful for applications which wish to sort different characters | ||
74 | equally; for example, providing a table with the same weights | ||
75 | for A\-Z as for a\-z will result in a case-insensitive sort. | ||
76 | If | ||
77 | .Fa table | ||
78 | is | ||
79 | .Dv NULL , | ||
80 | the contents of the array are sorted in ascending order according to the | ||
81 | ASCII order of the byte strings they reference and | ||
82 | .Fa endbyte | ||
83 | has a sorting weight of 0. | ||
84 | .Pp | ||
85 | The | ||
86 | .Fn sradixsort | ||
87 | function is stable; that is, if two elements compare as equal, their | ||
88 | order in the sorted array is unchanged. | ||
89 | The | ||
90 | .Fn sradixsort | ||
91 | function uses additional memory sufficient to hold | ||
92 | .Fa nmemb | ||
93 | pointers. | ||
94 | .Pp | ||
95 | The | ||
96 | .Fn radixsort | ||
97 | function is not stable, but uses no additional memory. | ||
98 | .Pp | ||
99 | These functions are variants of most-significant-byte radix sorting; in | ||
100 | particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise 10. | ||
101 | They take linear time relative to the number of bytes in the strings. | ||
102 | .Sh RETURN VALUES | ||
103 | .Rv -std | ||
104 | .Sh ERRORS | ||
105 | .Bl -tag -width Er | ||
106 | .It Bq Er EINVAL | ||
107 | The value of the | ||
108 | .Fa endbyte | ||
109 | element of | ||
110 | .Fa table | ||
111 | is not 0 or 255. | ||
112 | .El | ||
113 | .Pp | ||
114 | Additionally, the | ||
115 | .Fn sradixsort | ||
116 | function may fail and set | ||
117 | .Va errno | ||
118 | for any of the errors specified for the library routine | ||
119 | .Xr malloc 3 . | ||
120 | .Sh SEE ALSO | ||
121 | .Xr sort 1 , | ||
122 | .Xr qsort 3 | ||
123 | .Rs | ||
124 | .%A Knuth, D.E. | ||
125 | .%D 1968 | ||
126 | .%B "The Art of Computer Programming" | ||
127 | .%T "Sorting and Searching" | ||
128 | .%V Vol. 3 | ||
129 | .%P pp. 170-178 | ||
130 | .Re | ||
131 | .Rs | ||
132 | .%A Paige, R. | ||
133 | .%D 1987 | ||
134 | .%T "Three Partition Refinement Algorithms" | ||
135 | .%J "SIAM J. Comput." | ||
136 | .%V Vol. 16 | ||
137 | .%N No. 6 | ||
138 | .Re | ||
139 | .Rs | ||
140 | .%A McIlroy, P. | ||
141 | .%D 1993 | ||
142 | .%B "Engineering Radix Sort" | ||
143 | .%T "Computing Systems" | ||
144 | .%V Vol. 6:1 | ||
145 | .%P pp. 5-27 | ||
146 | .Re | ||
147 | .Sh HISTORY | ||
148 | The | ||
149 | .Fn radixsort | ||
150 | function first appeared in | ||
151 | .Bx 4.3 Net/2 . | ||