{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

7 - efficiency - Program Efficiency and Complexity What...

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

View Full Document Right Arrow Icon
Programming and Data Structures 1 Program Efficiency and Complexity What will we be looking at: • What is an "efficient" program? • How can we measure efficiency? • The Big O, Big Theta and Big Omega Notation • Asymtotic Analysis
Background image of page 1

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

View Full Document Right Arrow Icon
Programming and Data Structures 2 Why Measure Efficiency • Many ways to solve a problem. - but which way (i.e. algorithm) is better • Moore’s Law : - Number of transistors on CPU doubles every year (well more precisely every 18 months) - i.e. System performance doubles (well almost) every 18 months or so. • If this is so and with current speeds of cpu’s these days, then why bother worrying about how efficient our code is?
Background image of page 2
Programming and Data Structures 3 A Classic Optimisation Problem • Many optimisation problems can be formulated as a Travelling Salesman problem. • The Travelling Salesman problem: - Stated : “ A travelling salesman has to visit 100 different locations in a town, what is the shortest route that he can take.” - Total number of distinct routes possible : 100! 30 100 • What does this mean in turns of running time? - A supercomputer capable of checking 100 billion routes per second can check roughly about 10 20 routes in the space of one year. - Millions of years needed to check all routes!
Background image of page 3

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

View Full Document Right Arrow Icon