2-23 - Problem Solving with Computers-II CS 24 1 Recap...

Info iconThis preview shows pages 1–17. Sign up to view the full content.

View Full Document Right Arrow Icon
Problem Solving with Computers-II CS 24 February 23, 2010 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Recap Recursion General structure of recursive solutions Why do recursive solutions terminate? How do recursive programs manage the stack? Tail recursion When to use recursion? 2
Background image of page 2
Lecture Plan Tree ADT Binary Search Tree (BST) ADT Feedback on Lab sections Wednesday’s lab section Ontology ADT Course feedback Programming project Teams Second midterm 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Owner Jake Manager Chef Brad Carol Waitress Waiter Cook Helper Joyce Chris Max Len Jake’s Pizza Shop UNIQUE PATH BETWEEN NODES
Background image of page 4
5 Owner Jake Manager Chef Brad Carol Waitress Waiter Cook Helper Joyce Chris Max Len Nomenclature ROOT NODE LEAF NODE LEVEL 0 LEVEL 1 LEVEL 2 PARENT, CHILD, ANCESTOR, DESCENDANT SUBTREE
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Trees Level: Distance of a node from root Height: The maximum level
Background image of page 6
7 Trees Why is this not a tree ?
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 A node can have at most two children. The two children of a node are called the left child and the right child, if they exist. Binary Tree
Background image of page 8
9 A Binary Tree Q V T K S A E L
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10 How Many Leaf Nodes? Q V T K S A E L
Background image of page 10
11 How Many Descendants of Q? Q V T K S A E L
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12 How Many Ancestors of K? Q V T K S A E L
Background image of page 12
13 Trees How many different binary trees can be made from 2 nodes? 4 nodes? 6 nodes?
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
14 Implementing a Binary Tree with Pointers and Dynamic Data Q V T K S A E L
Background image of page 14
15 Structure of a Tree Node Possible to add a parent pointer
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
16 A special kind of binary tree in which: 1. Each node contains a distinct data value, 2. The key values in the tree can be compared using “greater than” and “less than”, and 3. The key value of each node in the tree is less than every key value in its right subtree , and greater than every key value in its left subtree.
Background image of page 16
Image of page 17
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/26/2010 for the course CS cs24 taught by Professor Singh during the Winter '10 term at UCSB.

Page1 / 39

2-23 - Problem Solving with Computers-II CS 24 1 Recap...

This preview shows document pages 1 - 17. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online