(See file BT.cpp in the week11 notes section, or
pp. 461, 462 of the Carrano text.)
Briefly Discuss the other binary tree operations
(For a list of function prototypes for the
operations, see the file BT.h in the week11
directory. See pp. 446-448 of the text for a set
of specifications of all the operations.)
We note what these operations are and what they
do, but we do not need to spend much time in class
considering them.
Briefly discuss the ADT table -- see the specs in Carrano, Chapter
11, p. 529.
The table is important -- a basic data type for representing
many kinds of databases.
We can use a simple array based list or linked list to
implement a table, but neither of these implementations will
be very efficient if the number of items to be stored is
large. (Discuss)
The table ADT can be implemented quite efficiently as a
binary search tree. This explains the importance of binary
search trees.
Organization of the Table data type -- There is a
totally ordered set of keys. Each element of the
table contains a data field. Each element is also
assigned a unique key. Elements and the data in
them are accessed by key value.
Elements of a Table data type -- data fields from
any homogeneos set -- typically each element of
the table is a certain kind of record which may
contain many different information fields -- an
employee record for example.
Major Table data type Operations
Insert by key value
Delete by key value
Retrieve by key value
Traverse Table
What is the reason for using BST's? -- they provide a hybrid of
the array and linked list versions of a table in which all major
operations can be implemented efficiently.
ADT binary search tree
Organization -- A binary search tree is a binary tree in
which each node contains a key that is an element of a totally
ordered set. For every node N in the tree, all keys in the
left subtree of N are less than the key in N, and all keys in
the right subtree of N are greater than the key in N.
Elements -- any given homogeneous set
Operations -- see the file BST.h (week11 directory
or p. 487 of Carrano) for the list and the specs.
Discuss the following, just conceptually with
diagrams (we will look at actual code next week.)