100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Lecture Notes on Lists II and Binary Trees (COMP11120) $7.13   Add to cart

Class notes

Lecture Notes on Lists II and Binary Trees (COMP11120)

 9 views  0 purchase
  • Course
  • Institution

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...

[Show more]

Preview 1 out of 2  pages

  • May 30, 2024
  • 2
  • 2023/2024
  • Class notes
  • Andrea schalk
  • More on lists, and introduction to binary trees
  • Unknown
avatar-seller
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

= no (trees (t , tl) not = 2i + 1


not =
2j + 1

L


= 1 + 2i + 1 + 2j1
= 1 + 2(i + j +
1)

=
1 + even


= odd

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

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

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

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.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

76747 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$7.13
  • (0)
  Add to cart