CSCE 3110  Data Structures  & Algorithm AnalysisRada Mihalceahttp://www.cs.unt.edu/~rada/CSCE3110Trees Applications
Trees: A Review (again? )General trees  one parent, N childrenBinary tree  ISA General tree  + max 2 childrenBinary searc...
Trees: A Review (cont’d)Multi-way search tree  ISA General tree  + Each node has K keys and K+1 children  + All keys in ch...
Tree ApplicationsData Compression  Huffman treeAutomatic Learning  Decision trees
Huffman codeVery often used for text compressionDo you know how gzip or winzip works? Compression methodsASCII code uses ...
Huffman Code  Build a list of letters and frequencies“have a great day today”  Build a Huffman Tree bottom up, by grouping...
Huffman CodesWrite the Huffman codes for the strings  “abracadabra”  “Veni Vidi Vici”
Huffman CodeRunning time?Suppose N letters in input string, with L uniquelettersWhat is the most important factor for obta...
One More ApplicationHeuristic Search  Decision TreesGiven a set of examples, with an associateddecision (e.g. good/bad, +/...
Data RecordsName             A B CDE FG1. Jeffrey B.    1 0 1 0 1 0 1-2. Paul S.       0 1 1 0 0 0 1-3. Daniel C.     0 0 ...
Fields in the RecordA: First name ends in a vowel?B: Neat handwriting?C: Middle name listed?D: Senior?E: Got extra-extra c...
Build a Classification TreeInternal nodes: featuresLeaves: classification                            F                    ...
Different Search ProblemGiven a set of data records with their  classifications, pick a decision tree: search  problem!Cha...
“Perfect” Decision Tree               C       middle name?           0           1               0       E    EEC?        ...
Search For a Classification  Classify new recordsNew1. Mike M.            1 0 1 1 0 0 1 ?New2. Jerry K.           0 1 0 1 ...
The very last tree forthis class
Upcoming SlideShare
Loading in...5
×

Tree apps

141

Published on

data structure trees

Published in: Technology, Business
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
141
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Tree apps

  1. 1. CSCE 3110 Data Structures & Algorithm AnalysisRada Mihalceahttp://www.cs.unt.edu/~rada/CSCE3110Trees Applications
  2. 2. Trees: A Review (again? )General trees one parent, N childrenBinary tree ISA General tree + max 2 childrenBinary search tree ISA Binary tree + left subtree < parent < right subtreeAVL tree ISA Binary search tree + | height left subtree – height right subtree | ≤ 1
  3. 3. Trees: A Review (cont’d)Multi-way search tree ISA General tree + Each node has K keys and K+1 children + All keys in child K < key K < all keys in child K+12-4 Tree ISA Multi-way search tree + All nodes have at most 3 keys / 4 children + All leaves are at the same levelB-Tree ISA Multi-way search tree + All nodes have at least T keys, at most 2T(+1) keys + All leaves are at the same level
  4. 4. Tree ApplicationsData Compression Huffman treeAutomatic Learning Decision trees
  5. 5. Huffman codeVery often used for text compressionDo you know how gzip or winzip works? Compression methodsASCII code uses codes of equal length for allletters  how many codes?Today’s alternative to ASCII?Idea behind Huffman code: use shorter lengthcodes for letters that are more frequent
  6. 6. Huffman Code Build a list of letters and frequencies“have a great day today” Build a Huffman Tree bottom up, by grouping letters with smaller occurrence frequencies
  7. 7. Huffman CodesWrite the Huffman codes for the strings “abracadabra” “Veni Vidi Vici”
  8. 8. Huffman CodeRunning time?Suppose N letters in input string, with L uniquelettersWhat is the most important factor for obtaininghighest compression?Compare: [assume a text with a total of 1000characters] I. Three different characters, each occurring the same number of times II. 20 different characters, 19 of them occurring only once, and the 20st occurring the rest of the time
  9. 9. One More ApplicationHeuristic Search Decision TreesGiven a set of examples, with an associateddecision (e.g. good/bad, +/-, pass/fail,caseI/caseII/caseIII, etc.)Attempt to take (automatically) a decisionwhen a new example is presented Predict the behavior in new cases!
  10. 10. Data RecordsName A B CDE FG1. Jeffrey B. 1 0 1 0 1 0 1-2. Paul S. 0 1 1 0 0 0 1-3. Daniel C. 0 0 1 0 0 0 0-4. Gregory P. 1 0 1 0 1 0 0-5. Michael N. 0 0 1 1 0 0 0-6. Corinne N. 1 1 1 0 1 0 1+7. Mariyam M. 0 1 0 1 0 0 1+8. Stephany D. 1 1 1 1 1 1 1+9. Mary D. 1 1 1 1 1 1 1+10. Jamie F. 1 1 1 0 0 1 1+
  11. 11. Fields in the RecordA: First name ends in a vowel?B: Neat handwriting?C: Middle name listed?D: Senior?E: Got extra-extra credit?F: Google brings up home page?G: Google brings up reference?
  12. 12. Build a Classification TreeInternal nodes: featuresLeaves: classification F 0 1 A D 2,3,7 1,4,5,6 10 A Error: 30% 8,9
  13. 13. Different Search ProblemGiven a set of data records with their classifications, pick a decision tree: search problem!Challenges: Scoring function? Large space of trees.What’s a good tree? Low error on given set of records Small
  14. 14. “Perfect” Decision Tree C middle name? 0 1 0 E EEC? 1 Google? F B Neat? 0 0 1 1Training set Error: 0%(can always do this?)
  15. 15. Search For a Classification Classify new recordsNew1. Mike M. 1 0 1 1 0 0 1 ?New2. Jerry K. 0 1 0 1 0 0 0 ?
  16. 16. The very last tree forthis class
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×