Presentation is loading. Please wait.

Presentation is loading. Please wait.

ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: TEL 3049.

Similar presentations


Presentation on theme: "ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: TEL 3049."— Presentation transcript:

1 ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: http://people.math.yorku.ca/~zyang/it ec2620m.htm Office: TEL 3049

2 Complexity Estimation

3 3 Key Points of this Lecture Estimation of non-recursive algorithms –Best, Worst, and Average cases –How many times? –What does it cost?

4 4 Best, Worst, and Average Cases Why do people buy lottery tickets? –Win a million dollars Case?  Best Why should you invest in the stock market? –Best long term investment (compared to bonds and cash) Case?  Average Lottery –Average case  waste your money Stock market –Worst case  crash – lose everything

5 5 Which case should we use to make decisions Average case  most often Best case  when reasonable expectation exists Worst case  when guarantees are required

6 6 Best, Worst, and Average cases in Algorithm Analysis Is there a conditional execution? –while loops –branching with different cost alternatives Best Case –minimal execution Worst Case –maximal execution Average Case –median (50-50) case –not necessarily (Best + Worst)/2 !

7 7 Using Complexity The most important thing about algorithm analysis is to determine big- Oh – the approximate complexity –why? –need to be able to estimate program running times Do we need all the math? –not really

8 8 Complexity Estimation and Complexity Analysis Complexity Estimation –Two key questions How many times? What does it cost? Relating Complexity Estimation to Complexity Analysis –“How many times?” is the summation –“What does it cost?” is what’s inside the summation More accurate questions –What does it cost each time? –What does it cost on average? Example


Download ppt "ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: TEL 3049."

Similar presentations


Ads by Google