4.4BSD/usr/share/man/cat3/radixsort.0

Compare this file to the similar file:
Show the results in this format:

RADIXSORT(3)                BSD Programmer's Manual               RADIXSORT(3)

NNAAMMEE
     rraaddiixxssoorrtt - radix sort

SSYYNNOOPPSSIISS
     ##iinncclluuddee <<lliimmiittss..hh>>
     ##iinncclluuddee <<ssttddlliibb..hh>>

     _i_n_t
     rraaddiixxssoorrtt(_u___c_h_a_r _*_*_b_a_s_e, _i_n_t _n_m_e_m_b, _u___c_h_a_r _*_t_a_b_l_e, _u___i_n_t _e_n_d_b_y_t_e);

     _i_n_t
     ssrraaddiixxssoorrtt(_u___c_h_a_r _*_*_b_a_s_e, _i_n_t _n_m_e_m_b, _u___c_h_a_r _*_t_a_b_l_e, _u___i_n_t _e_n_d_b_y_t_e);

DDEESSCCRRIIPPTTIIOONN
     The rraaddiixxssoorrtt() and ssrraaddiixxssoorrtt() functions are implementations of radix
     sort.

     These functions sort an array of pointers to byte strings, the initial
     member of which is referenced by _b_a_s_e. The byte strings may contain any
     values; the end of each string is denoted by the user-specified value
     _e_n_d_b_y_t_e.

     Applications may specify a sort order by providing the _t_a_b_l_e argument.
     If non-NULL, _t_a_b_l_e must reference an array of UCHAR_MAX + 1 bytes which
     contains the sort weight of each possible byte value.  The end-of-string
     byte must have a sort weight of 0 or 255 (for sorting in reverse order).
     More than one byte may have the same sort weight.  The _t_a_b_l_e argument is
     useful for applications which wish to sort different characters equally,
     for example, providing a table with the same weights for A-Z as for a-z
     will result in a case-insensitive sort.  If _t_a_b_l_e is NULL, the contents
     of the array are sorted in ascending order according to the ASCII order
     of the byte strings they reference and _e_n_d_b_y_t_e has a sorting weight of 0.

     The ssrraaddiixxssoorrtt() function is stable, that is, if two elements compare as
     equal, their order in the sorted array is unchanged.  The ssrraaddiixxssoorrtt()
     function uses additional memory sufficient to hold _n_m_e_m_b pointers.

     The rraaddiixxssoorrtt() function is not stable, but uses no additional memory.

     These functions are variants of most-significant-byte radix sorting; in
     particular, see D.E. Knuth's Algorithm R and section 5.2.5, exercise 10.
     They take linear time relative to the number of bytes in the strings.

RREETTUURRNN VVAALLUUEESS
     Upon successful completion 0 is returned.  Otherwise, -1 is returned and
     the global variable _e_r_r_n_o is set to indicate the error.

EERRRROORRSS
     [EINVAL]      The value of the _e_n_d_b_y_t_e element of _t_a_b_l_e is not 0 or 255.

     Additionally, the ssrraaddiixxssoorrtt() function may fail and set _e_r_r_n_o for any of
     the errors specified for the library routine malloc(3).

SSEEEE AALLSSOO
     sort(1),  qsort(3)

     Knuth, D.E., "Sorting and Searching", _T_h_e _A_r_t _o_f _C_o_m_p_u_t_e_r _P_r_o_g_r_a_m_m_i_n_g,
     Vol. 3, pp. 170-178, 1968.

     Paige, R., "Three Partition Refinement Algorithms", _S_I_A_M _J_. _C_o_m_p_u_t_., No.
     6, Vol. 16, 1987.

HHIISSTTOORRYY
     The rraaddiixxssoorrtt() function first appeared in 4.4BSD.