6a00dc5ed2
Submitted by: Yuko Sasaki <yuko@veltec.co.jp>
154 lines
4.5 KiB
Groff
154 lines
4.5 KiB
Groff
.\" Copyright (c) 1990, 1991, 1993
|
||
.\" The Regents of the University of California. All rights reserved.
|
||
.\"
|
||
.\" Redistribution and use in source and binary forms, with or without
|
||
.\" modification, are permitted provided that the following conditions
|
||
.\" are met:
|
||
.\" 1. Redistributions of source code must retain the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer.
|
||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||
.\" notice, this list of conditions and the following disclaimer in the
|
||
.\" documentation and/or other materials provided with the distribution.
|
||
.\" 3. All advertising materials mentioning features or use of this software
|
||
.\" must display the following acknowledgement:
|
||
.\" This product includes software developed by the University of
|
||
.\" California, Berkeley and its contributors.
|
||
.\" 4. Neither the name of the University nor the names of its contributors
|
||
.\" may be used to endorse or promote products derived from this software
|
||
.\" without specific prior written permission.
|
||
.\"
|
||
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||
.\" SUCH DAMAGE.
|
||
.\"
|
||
.\" @(#)radixsort.3 8.2 (Berkeley) 1/27/94
|
||
.\" %FreeBSD: src/lib/libc/stdlib/radixsort.3,v 1.5.2.4 2001/12/14 18:33:58 ru Exp %
|
||
.\" $FreeBSD$
|
||
.\"
|
||
.Dd January 27, 1994
|
||
.Dt RADIXSORT 3
|
||
.Os
|
||
.Sh ̾<EFBFBD><EFBFBD>
|
||
.Nm radixsort
|
||
.Nd <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Sh <EFBFBD>饤<EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD>
|
||
.Lb libc
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.In limits.h
|
||
.In stdlib.h
|
||
.Ft int
|
||
.Fn radixsort "const unsigned char **base" "int nmemb" "const unsigned char *table" "unsigned endbyte"
|
||
.Ft int
|
||
.Fn sradixsort "const unsigned char **base" "int nmemb" "const unsigned char *table" "unsigned endbyte"
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Fn radixsort
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD><EFBFBD>
|
||
.Fn sradixsort
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD>ϡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD>ǥ<EFBFBD><C7A5>å<EFBFBD><C3A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><C6A4>ޤ<EFBFBD><DEA4><EFBFBD>
|
||
.Pp
|
||
<EFBFBD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FBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȥ<EFBFBD><EFBFBD>ͤ<EFBFBD> 0 <20><> 255 <20>ˤʤäƤ<C3A4><C6A4>ޤ<EFBFBD><DEA4><EFBFBD><EFBFBD><EFBFBD>
|
||
.El
|
||
.Pp
|
||
.Fn sradixsort
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD>ϡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>顼<EFBFBD><EFBFBD>ȯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>饤<EFBFBD>֥<EFBFBD><EFBFBD><EFBFBD><EFBFBD>롼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Xr malloc 3
|
||
<EFBFBD>ǻ<EFBFBD><EFBFBD>ꤵ<EFBFBD><EFBFBD><EFBFBD>Ƥ<EFBFBD><EFBFBD>륨<EFBFBD>顼<EFBFBD><EFBFBD>
|
||
.Va errno
|
||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ꤹ<EFBFBD>뤳<EFBFBD>Ȥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD>
|
||
.Sh <EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Xr sort 1 ,
|
||
.Xr qsort 3
|
||
.Pp
|
||
.Rs
|
||
.%A Knuth, D.E.
|
||
.%D 1968
|
||
.%B "The Art of Computer Programming"
|
||
.%T "Sorting and Searching"
|
||
.%V Vol. 3
|
||
.%P pp. 170-178
|
||
.Re
|
||
.Rs
|
||
.%A Paige, R.
|
||
.%D 1987
|
||
.%T "Three Partition Refinement Algorithms"
|
||
.%J "SIAM J. Comput."
|
||
.%V Vol. 16
|
||
.%N No. 6
|
||
.Re
|
||
.Rs
|
||
.%A McIlroy, P.
|
||
.%D 1993
|
||
.%B "Engineering Radix Sort"
|
||
.%T "Computing Systems"
|
||
.%V Vol. 6:1
|
||
.%P pp. 5-27
|
||
.Re
|
||
.Sh <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
.Fn radixsort
|
||
<EFBFBD>ؿ<EFBFBD><EFBFBD>ϡ<EFBFBD>
|
||
.Bx 4.4
|
||
<EFBFBD>ˤϤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>о줷<EFBFBD>ޤ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|