Upload
screwperman
View
571
Download
0
Tags:
Embed Size (px)
Citation preview
The Complexityof Songs
By Rohan Sharma
Disclaimer
“The Ideal Talk”
Introduction
Informative
Accessible
< 10 minutes
My Talk
No introduction
Uninformative
Arcane
Possibly> 10 minutes
Possibly> 10 minutes
</Disclaimer>
ComputerScience
ComputerScience
ComputerScience
ComputerScience
Astronomy
Warning:Boring Stuff Ahead!
Computational Complexity
Largest Member
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
3 2 7 9 1
Linear TimeO(n)
Binary Search
3 7 10 21 33 39 46
Search for 10
3 7 10
Search for 10
10
Found 10
Logarithmic timeO(lg n)
The Complexity of Songs
How?
Letters?
Tedious!
Words?
Yes!
Toughest: O(n) Easiest: O(1)
Never gonna give you upNever gonna let you downNever gonna run around and desert youNever gonna make you cryNever gonna say goodbyeNever gonna tell a lie and hurt you
Never gonna give you upNever gonna let you downNever gonna run around and desert youNever gonna make you cryNever gonna say goodbyeNever gonna tell a lie and hurt you
FAIL
Breakthrough
O(n1/2)
The Twelve Days of Christmas
On the first day of Christmas my true love sent to me A partridge in a pear tree.
On the second day of Christmas my true love sent to me Two turtle doves, and a partridge in a pear tree.
On the third day of Christmas, my true love sent to me Three French hens, two turtle doves, and a partridge in a pear tree.
The Twelve Days of Christmas
On the first day of Christmas my true love sent to me gift 1
On the second day of Christmas my true love sent to me gift 1, gift 2
On the third day of Christmas, my true love sent to me gift 1, gift 2, gift 3
...
On the nth day of Christmas, my true love sent to me gift 1, gift 2, gift 3, ..., gift n
The Twelve Days of Christmas
gift 1gift 1, gift 2gift 1, gift 2, gift 3...gift 1, gift 2, gift 3, ..., gift n
The Twelve Days of Christmas
gift 1gift 1, gift 2gift 1, gift 2, gift 3...gift 1, gift 2, gift 3, ..., gift n
O(n1/2)
Breakthrough #2
N Bottles of Beer
n bottles of beer on the walln bottles of beer!You take one down, and pass it aroundn - 1 bottles of beer on the wall!
O(lg n)
O(1)
Questions?