Mathematical Techniques for Computer Science (COMP11120)
Class notes
Lecture Notes on Lists II and Binary Trees (COMP11120)
9 views 0 purchase
Course
Mathematical Techniques for Computer Science (COMP11120)
Institution
The University Of Manchester (UOM)
Enhance your understanding of advanced list operations and binary trees with these comprehensive lecture notes for COMP11120. Covering essential topics such as list manipulation, traversal techniques, binary tree structures, and tree traversal algorithms, these notes are designed to provide you wit...
More on lists, and introduction to binary trees
Subjects
binary trees
semester 2
andrea schalk
Written for
The University of Manchester (UOM)
Unknown
Mathematical Techniques for Computer Science (COMP11120)
All documents for this subject (9)
Seller
Follow
jpxoi
Content preview
More on Lists, and Introduction to Binary Trees
Binary Trees
Terminology
L root
in a
binary tree every mode >
- in a full binary tree
, every node
7
has at most 2 children
. ·
is either a leaf
leaves & · or has a left and right child , which themselves are the root of a tree.
full binary tree
T 7 in a
every node
has 0 or 2 children
. - a full binary tree consists of
· either just a root mode
· or a root and a left and a right (subtree.
Full Binary Trees
Definition A full binary tree with labels from set S base Step case
: a is given
by case
basecase trees where seS tree S 7 S treeg (t t) ,
> S
,
Step case Given trees t ,
t with labels from S
, t t
treeg (t ,
tl) is a tree with labels from S
.
Example : trees (treen (troes treez) , , treed
3
#
*
-
H 04
#
3 28
↑
FBTreess : set of all full binary trees with labels from S
.
Example Define
: operation FBTreess <
IN that returns the height of Example : Give an operation no :
FiTreess > 11I that returns the
tree number of nodes tree
a .
of a .
base case Light (trees) = D base case noltroos) =
1
Step case Light (trees (t t)) ,
= 1 + max light , light ↑
Step case no(troeg(t ,
t) = not + not + 1
Example : Show that for all to FBTroesg ,
light not Example : Show that for te FBTreesg ,
not is old
base case Light trees = 0 1 = no trees base case noltrees) = 1 which is odd
Step case
hight (treeg(t t ,
=
1 + max (lightt lightt) , ind .
hyp not , not' are odd
max(a, b) ( a + b
& 1 +
light + lightt Step case nol trees (t t) = 1 + not + not
,
not not E *
>
- 1 + + indhyp by ind .
hyp . We can find i
,
je IN such that
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller jpxoi. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.13. You're not tied to anything after your purchase.