Browse Source

typos from Brian Poole;

ok deraadt@
OPENBSD_3_4
jmc 21 years ago
parent
commit
3880dcdbcd
2 changed files with 6 additions and 6 deletions
  1. +4
    -4
      src/lib/libc/stdlib/heapsort.c
  2. +2
    -2
      src/lib/libc/stdlib/qsort.3

+ 4
- 4
src/lib/libc/stdlib/heapsort.c View File

@ -31,7 +31,7 @@
*/ */
#if defined(LIBC_SCCS) && !defined(lint) #if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$OpenBSD: heapsort.c,v 1.4 2003/06/02 20:18:37 millert Exp $";
static char *rcsid = "$OpenBSD: heapsort.c,v 1.5 2003/09/07 18:57:05 jmc Exp $";
#endif /* LIBC_SCCS and not lint */ #endif /* LIBC_SCCS and not lint */
#include <sys/types.h> #include <sys/types.h>
@ -68,7 +68,7 @@ static char *rcsid = "$OpenBSD: heapsort.c,v 1.4 2003/06/02 20:18:37 millert Exp
* Build the list into a heap, where a heap is defined such that for * Build the list into a heap, where a heap is defined such that for
* the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N. * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N.
* *
* There two cases. If j == nmemb, select largest of Ki and Kj. If
* There are two cases. If j == nmemb, select largest of Ki and Kj. If
* j < nmemb, select largest of Ki, Kj and Kj+1. * j < nmemb, select largest of Ki, Kj and Kj+1.
*/ */
#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \ #define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \
@ -90,12 +90,12 @@ static char *rcsid = "$OpenBSD: heapsort.c,v 1.4 2003/06/02 20:18:37 millert Exp
* Select the top of the heap and 'heapify'. Since by far the most expensive * Select the top of the heap and 'heapify'. Since by far the most expensive
* action is the call to the compar function, a considerable optimization * action is the call to the compar function, a considerable optimization
* in the average case can be achieved due to the fact that k, the displaced * in the average case can be achieved due to the fact that k, the displaced
* elememt, is ususally quite small, so it would be preferable to first
* elememt, is usually quite small, so it would be preferable to first
* heapify, always maintaining the invariant that the larger child is copied * heapify, always maintaining the invariant that the larger child is copied
* over its parent's record. * over its parent's record.
* *
* Then, starting from the *bottom* of the heap, finding k's correct place, * Then, starting from the *bottom* of the heap, finding k's correct place,
* again maintianing the invariant. As a result of the invariant no element
* again maintaining the invariant. As a result of the invariant no element
* is 'lost' when k is assigned its correct place in the heap. * is 'lost' when k is assigned its correct place in the heap.
* *
* The time savings from this optimization are on the order of 15-20% for the * The time savings from this optimization are on the order of 15-20% for the


+ 2
- 2
src/lib/libc/stdlib/qsort.3 View File

@ -29,7 +29,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE. .\" SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: qsort.3,v 1.12 2003/06/02 20:18:38 millert Exp $
.\" $OpenBSD: qsort.3,v 1.13 2003/09/07 18:57:05 jmc Exp $
.\" .\"
.Dd June 4, 1993 .Dd June 4, 1993
.Dt QSORT 3 .Dt QSORT 3
@ -122,7 +122,7 @@ a variant of selection sorting; in particular, see D.E. Knuth's Algorithm H.
.Fn heapsort .Fn heapsort
takes O N lg N worst-case time. takes O N lg N worst-case time.
This implementation of This implementation of
.Fn qsort
.Fn heapsort
is implemented without recursive function calls. is implemented without recursive function calls.
.Pp .Pp
The function The function


Loading…
Cancel
Save