chapter 5
play

Chapter 5: Algorithms and Heuristics CS105: Great Insights in - PowerPoint PPT Presentation

Chapter 5: Algorithms and Heuristics CS105: Great Insights in Computer Science Song Growth Lets talk about how many syllables we sing given a song of a certain type as the number of verses grows. In general, were interested in


  1. Chapter 5: Algorithms and Heuristics CS105: Great Insights in Computer Science

  2. Song Growth • Let’s talk about how many syllables we sing given a song of a certain type as the number of verses grows. • In general, we’re interested in the number of syllables as a function of n , the number of verses.

  3. Generalized Dreidel Song 1. I had a little dreidel 3. I had a little dreidel, 6. I had a little dreidel, I made it out of clay I made it out of glass I made it out of ice, And when it's dry and ready My mom said when I spin it, but when I went to spin it, Oh dreidel I shall play. to spin it on the grass. it melted...that's not nice!! Chorus: Chorus Chorus Oh dreidel dreidel dreidel I made it out of clay 4. I had a little dreidel, 7. I had a little dreidel, And when it's dry and ready I made it out of chocolate, I made it out of mud, Oh dreidel I shall play. but when I went to spin it, and when I went to spin it, it had melted in my pocket. it fell down with a thud. 2. I had a little dreidel I made it out of plastic Chorus Chorus If someone steals my dreidel I'll do something very drastic. 5. I had a little dreidel, 8. I had a little dreidel, I made it out of wood, I made it out of tin, Chorus and when I went to spin it, I made it kind of crooked, it spun just like it should. and so I always win. Chorus Chorus

  4. Counting Syllables verses syllables verses syllables 1 51 5 271 2 109 6 323 3 161 7 375 4 219 8 432

  5. Plotting Syllables 500 375 syllables 250 125 0 1 2 3 4 5 6 7 8 verses: n • Total syllables roughly, T( n ) = 54 n .

  6. Old Macdonald: Verse 4 Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  7. Old Macdonald: Verse 4 Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  8. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  9. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  10. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  11. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  12. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there 22 syllables Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  13. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there 22 syllables Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  14. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there 22 syllables Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

  15. Old Macdonald: Verse 4 25 syllables Old Macdonald had a farm, E-I-E-I-O And on his farm he had a chick, E-I-E-I-O With a "cluck, cluck" here and a "cluck, cluck" there 22 syllables Here a "cluck" there a "cluck" Everywhere a "cluck-cluck" With a "neigh, neigh" here and a "neigh, neigh" there Here a "neigh" there a "neigh" Everywhere a "neigh-neigh" With a (snort) here and a (snort) there Here a (snort) there a (snort) Everywhere a (snort-snort) With a "moo-moo" here and a "moo-moo" there Here a "moo" there a "moo" 12 syllables Everywhere a "moo-moo" Old Macdonald had a farm, E-I-E-I-O

Recommend


More recommend