1 / 17

Algorithms and Complexity 1: Introduction

Algorithms and Complexity 1: Introduction. John Levine John.Levine@cis.strath.ac.uk. 1. Introductory Lecture. What’s an algorithm then? Intro and brief history Sample use of algorithms Sample algorithm Course overview Lectures, practical, labs/tuts, the exam. First, who am I?.

reya
Download Presentation

Algorithms and Complexity 1: Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms and Complexity1: Introduction John Levine John.Levine@cis.strath.ac.uk 1 John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  2. Introductory Lecture • What’s an algorithm then? • Intro and brief history • Sample use of algorithms • Sample algorithm • Course overview • Lectures, practical, labs/tuts, the exam John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  3. First, who am I? • Senior Lecturer in Comp Sci • Contact details • John.Levine@cis.strath.ac.uk • www.cis.strath.ac.uk/~johnl/ • Livingston Tower L13.21 • Contact me on ext 4524 • Background in AI planning, artificial evolution and AI in computer games John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  4. What’s an Algorithm then? • Top level of programming • Algorithm (e.g. Binary search) • Program source (e.g. Java) • Byte code (e.g. Java VM) • Machine code (e.g. PowerPC, Pentium III) John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  5. COOKING GUIDELINESFor best results cook from frozenTo microwave:  Remove sleeve and pierce film lid several times. 750 watt or category D oven: 3 minute full power Turn dish 3 minute full power 650 watt or category B oven: 3 minute full power Turn dish 3 minute full power To Oven Bake:  Remove sleeve and pierce film lid several times.  Place on a Baking tray in a pre-heated oven 190 °C, 375 °F, Gas Mark 5 for 35 - 40 minutes.  Adjust cooking times according to your particular oven.  For fan assisted ovens cooking times should be reduced.  For best results refer to the manufacturers handbook. CHECK FOOD IS PIPING HOT BEFORE SERVING.  DO NOT REHEAT. John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  6. Euclid – c300BC • Greatest common factor (GCD) of 2 integers: • divide the larger by the smaller • divide the smaller by the remainder of 1st • divide remainder of 1st by the remainder of 2nd • repeat until you get a remainder of zero • answer is last non-zero remainder John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  7. Abu Jafar Mohammed ibm Musa Al Khwarizmi • Invented mechanical method for adding numbers in AD800 John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  8. Toy Story • Algorithms often used to make doable unfeasibly large computations, e.g.: • Pixar chair Steve Jobs may be the cover boy, and director John Lasseter may get the creative glory, but animator Ed Catmull is the quiet techie whose algorithms put the zing into films like Toy Story and November's A Bug's Life- • Wired Oct 98 John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  9. Monsters Inc • 2.3 million hairs on Sulley • each shot (usually 3-10 seconds), took one to two hours to create John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  10. Monsters Inc “The rendering was completed in the Pixar Renderfarm, which is powered by 250 Sun ... servers, ... each using • 14 UltraSPARC™ II microprocessors • 14 gigabytes of system memory • and 196 gigabytes of local disk space for a total of 3,500 processors in production with nearly four terabytes of main memory.” Also see http://cgw.pennnet.com/ & search for “Monster Mash” John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  11. Room count • Approach 1: • Sequential from front right in looping rows • Approach 2: • Parallel from left to right then back to front John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  12. Complexity analysis • Approach 1 • If it takes 0.6 seconds per person then the total time will be 0.6n secs for n people • Approach 2 • If it takes 0.6 seconds per person to add 1 and 6 seconds to add at end of row, then total will be 0.6(n/r) + 6r for n people and r rows John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  13. Time to count John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  14. Course Content • Introduction (1 week approx) • Searching and sorting (1) • Binary trees (2) • Graph algorithms (3) • Permutations and combinations (2) John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  15. Course Details • Java Collections Watt & Brown • 20 Lectures • lecture & notes style • 20 Practicals • 20% coursework • 80% exam • www.cis.strath.ac.uk/~johnl/ac/ • news:strath.cis.teaching.ug.ac John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  16. @home: The travelling seller • Mary, a computer seller, needs to visit 3 shops in a day (starting and finishing at the office): what’s the shortest route? 8km 5km 2km 12km 3km John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

  17. Next time • Size matters • Complexity notation • Calculating complexities • Read chapter 2 in advance John Levine, Computer and Information Sciences, Strathclyde Universityhttp://www.cis.strath.ac.uk/~johnl/

More Related