COP3530 TREES

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

What is the minimum number of internal nodes in a binary tree with 8 nodes?

4

What is the minimum number of nodes in a full binary tree with height 3?

7

Which statement is false? Every node in a binary tree has exactly two children Every non-empty binary tree has exactly one root node Every binary tree has at least one node Every non-root node in a binary tree has exactly one parent None of the above

Every binary tree has at least one node

Select the one true statement.

Every binary tree is either complete or full Every complete binary tree is also a full binary tree Every full binary tree is also a complete binary tree No binary tree is both complete and full None of the above

What do we use trees for?

Family trees - names of the family decision trees file systems expression trees search trees

BST search, insert, and delete operations typically run in time O(d). What is d?

The depth of the relevant node in the tree

what is a full binary tree

a binary tree where all nodes have either 2 children or 0 children (leaf nodes)

What is a binary tree

a tree with each node consisting of at MOST 2 children

What is a binary search tree

an ordered binary tree all values go down as you go down so if we start with 51 as you go down it should be lower

all nodes that can be reached by moving only in an upward direction are

ancestors

The successors of a node are?

children

BST Traversals

depth first strategy in order , preorder,postoder breadth first strategy strategy

nodes that can be reached by moving only in a downward direction in the tree are

descendents

A binary tree is another name for a BST.

false

If you are given the order of the nodes as visited by a preorder traversal and the order of the nodes as visited by a postorder traversal, do you have enough information to reconstruct the original tree? Assume that the nodes all have unique values.

false

predecessors of a node's parent are?

grandparent

the ___ of a tree is the number of nodes in the longest path from the root node to a leaf node

height we can start with 1 or 0

What are some applications of trees?

include prioritizing jobs, describing mathematical expressions and the syntactic elements of computer programs, or organizing the information needed to drive data compression algorithms.

nodes with no children are called AT ALL

leaf nodes or external nodes

Euler Tour

left down back up right down up

postorder traversal

left subtree, right subtree, root

what is a complete binary tree

level h -1 at level h all towards to the left height is log n

the ___ of a node is the distance of that node from the root

levels

Trees are what order?

non linear

So, every binary tree node has two children, but

not every binary tree has a node.

Full binary trees is a

nternal node with exactly two non-empty children or (2) a leaf.

Trees have 3 properties

one root, each node has one parent, and has no cycles

Predecessors of a node are?

parent every child has 1 parent except the root .

What is the node at the top of the tree called?

root

all nodes that have the same parent node are?

siblings

a _ of a node is a tree whose root is a child of that node

subtree

What is an N-ary tree?

the normal tree a tree with each node consisting of at most n children

what is a perfect binary tree?

there have to be children filled to the last level height h with exactly 2^h - 1 height of the tree is o(log n )

The n nodes in a binary tree can be visited in:

theta n time

Traversal vs search

traversal requires you to visit each nodes not necessarily in search like it may jsut go to one side

If you are given the order of the nodes as visited by a preorder traversal and the order of the nodes as visited by an inorder traversal, do you have enough information to reconstruct the original tree? Assume that the nodes all have unique values.

true

inorder traversal

visit the left subtree visit the root visit the right subtree

preorder traversal

visit the root, visit the left subtree, visit the right subtree

level order

zig zag


Set pelajaran terkait

12 AP Lang Terms (Exemplification-Understatement)

View Set

Origin, Insertion, action, innervation

View Set

Chapter 11 - Network Performance and Recovery

View Set

Unit 7: Creation and Termination of Agency

View Set

5. PROBLEM SOLVING MODELS SARA - SCAN, ANALYSIS, RESPONSE, ASSESSMENT

View Set

Chapter 16 Practice Test: Nursing assessment

View Set