Deleted Added
full compact
tsearch.3 (108087) tsearch.3 (131504)
1.\" $NetBSD$
2.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp
1.\" $NetBSD$
2.\" Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26.\"
27.\" OpenBSD: tsearch.3,v 1.2 1998/06/21 22:13:49 millert Exp
28.\" $FreeBSD: head/lib/libc/stdlib/tsearch.3 108087 2002-12-19 09:40:28Z ru $
28.\" $FreeBSD: head/lib/libc/stdlib/tsearch.3 131504 2004-07-02 23:52:20Z ru $
29.\"
30.Dd June 15, 1997
31.Dt TSEARCH 3
32.Os
33.Sh NAME
34.Nm tsearch , tfind , tdelete , twalk
35.Nd manipulate binary search trees
36.Sh SYNOPSIS

--- 9 unchanged lines hidden (view full) ---

46.Sh DESCRIPTION
47The
48.Fn tdelete ,
49.Fn tfind ,
50.Fn tsearch ,
51and
52.Fn twalk
53functions manage binary search trees based on algorithms T and D
29.\"
30.Dd June 15, 1997
31.Dt TSEARCH 3
32.Os
33.Sh NAME
34.Nm tsearch , tfind , tdelete , twalk
35.Nd manipulate binary search trees
36.Sh SYNOPSIS

--- 9 unchanged lines hidden (view full) ---

46.Sh DESCRIPTION
47The
48.Fn tdelete ,
49.Fn tfind ,
50.Fn tsearch ,
51and
52.Fn twalk
53functions manage binary search trees based on algorithms T and D
54from Knuth (6.2.2). The comparison function passed in by
54from Knuth (6.2.2).
55The comparison function passed in by
55the user has the same style of return values as
56.Xr strcmp 3 .
57.Pp
58The
59.Fn tfind
60function
61searches for the datum matched by the argument
62.Fa key

--- 4 unchanged lines hidden (view full) ---

67.Pp
68The
69.Fn tsearch
70function
71is identical to
72.Fn tfind
73except that if no match is found,
74.Fa key
56the user has the same style of return values as
57.Xr strcmp 3 .
58.Pp
59The
60.Fn tfind
61function
62searches for the datum matched by the argument
63.Fa key

--- 4 unchanged lines hidden (view full) ---

68.Pp
69The
70.Fn tsearch
71function
72is identical to
73.Fn tfind
74except that if no match is found,
75.Fa key
75is inserted into the tree and a pointer to it is returned. If
76is inserted into the tree and a pointer to it is returned.
77If
76.Fa rootp
77points to a NULL value a new binary search tree is created.
78.Pp
79The
80.Fn tdelete
81function
82deletes a node from the specified binary search tree and returns
83a pointer to the parent of the node to be deleted.

--- 47 unchanged lines hidden ---
78.Fa rootp
79points to a NULL value a new binary search tree is created.
80.Pp
81The
82.Fn tdelete
83function
84deletes a node from the specified binary search tree and returns
85a pointer to the parent of the node to be deleted.

--- 47 unchanged lines hidden ---