l09-huffman

l09-huffman - CS112: Data Structures Lecture 9 Uses of...

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

View Full Document Right Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 1 Lecture 9 CS112: Data Structures CS112: Data Structures Lecture 9 Uses of trees
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 2 Lecture 9 Exam 1 results Exam 1 results Problem 2 was a large part of the problem Adding 10 points, Also making 20 extra credit percentage is out of 130 Sakai will stay the raw score
Background image of page 2
CS112: Slides for Prof. Steinberg ʼ s lecture 3 Lecture 9 Confusion Confusion “Each element of A has a 1/4 probability of being found in B.” Is NOT the same as “1/4 of the elements in A will be in B.”
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 4 Lecture 9 Example: toss two coins Example: toss two coins Toss two fair coins - a “double flip” Do it 4 times - a “trial” Probability of double flip heads-heads = 1/4 Does not mean that exactly one of the 4 double flips in a trial will always be heads- heads Does mean that the long run average number of heads-heads/trial approaches 1
Background image of page 4
CS112: Slides for Prof. Steinberg ʼ s lecture 5 Lecture 9 Worst case: no probability Worst case: no probability Probability only matters for average cost “Probability of case j is 1/n” Worst case cost: find the one case with highest cost No matter how likely or unlikely
Background image of page 5

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 6 Lecture 9 Example Example repeats, both n elements For each element in A, check if also in B One worst case, n = 4: A: 10, 10, 10, 10 B: 20, 23, 19, 10
Background image of page 6
CS112: Slides for Prof. Steinberg ʼ s lecture 7 Lecture 9 Review Review Built-in Hashing in Java Built-in Hashing in Java The class java.util.HashMap<K, V> Mapping from (unique) key to a value Note: generic with two class parameters: K: class of keys V: class of values E.g. Driver’s license ID (String) => Driver object (name, address, etc.): java.util.HashMap<String, Driver> See Driver.java and UseDriverMap.java
Background image of page 7

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

View Full DocumentRight Arrow Icon
CS112: Slides for Prof. Steinberg ʼ s lecture 8 Lecture 9 Traversals
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 32

l09-huffman - CS112: Data Structures Lecture 9 Uses of...

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

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