week 1
play

Week 1 Oliver Kullmann Organisation Computationa Getting Started - PowerPoint PPT Presentation

CS 270 Algorithms Week 1 Oliver Kullmann Organisation Computationa Getting Started problems and algorithms Insertion Organisation sort 1 Algorithm analysis Computational problems and algorithms 2 Exactly analysing Insertion-


  1. CS 270 Algorithms Week 1 Oliver Kullmann Organisation Computationa Getting Started problems and algorithms Insertion Organisation sort 1 Algorithm analysis Computational problems and algorithms 2 Exactly analysing Insertion- Insertion sort Sort 3 Discrete mathematics Algorithm analysis 4 Exactly analysing Insertion-Sort 5 Discrete mathematics 6

  2. CS 270 Organisation Algorithms Oliver Kullmann Organisation Computationa problems Lecturer Dr Oliver Kullmann and algorithms Monday 13 Glyndwr C Insertion sort Tuesday 9 Glyndwr B Lectures Algorithm Wednesday 10 Grove 330 analysis Thursday 11 Wallace JLT Exactly analysing Labs (choose one of the following two sessions) Insertion- Sort Thursday 12 Faraday 217 (Linux Lab) Discrete Thursday 13 Faraday 217 (Linux Lab) mathematics

  3. CS 270 Course home page Algorithms Oliver Kullmann Organisation Computationa problems http://www.cs.swan.ac.uk/~csoliver/Algorithms201112/index.html and algorithms Insertion sort with Algorithm analysis messages Exactly analysing general information Insertion- Sort up-to-date versions of the slides (which serve as the script) Discrete mathematics lab sheets course works.

  4. CS 270 Assessment Algorithms Oliver Kullmann Organisation Computationa problems and algorithms There will be two pieces of coursework, each worth 10%. Insertion sort Labs are an essential part of the course. Successful Algorithm analysis participations is worth 10%. Exactly The written examination counts 70%, it will take place in analysing Insertion- January. Sort Discrete mathematics

  5. CS 270 Lectures Algorithms Oliver Kullmann Organisation Computationa problems The script will usually be handed out at the beginning of and algorithms each week. Corrected version of the script are available on Insertion the course home-page. Usually, they will not be printed out sort again, except in cases where substantial changes have Algorithm analysis occurred. Exactly Left-over print-outs of the script can be found in the analysing Insertion- student’s office (Faraday Building Room 206) for those who Sort could not attend the lecture. Discrete mathematics You also have to sign the module attendance form.

  6. CS 270 References Algorithms Oliver Kullmann There are very many algorithms textbooks in print. In this module, we will follow (and refer to as CLRS ) Organisation Computationa problems Introduction to Algorithms (Third Edition) and algorithms by Cormen, Leiserson, Rivest and Stein, Insertion The MIT Press, 2009. sort Algorithm LIS Call Number: QA76.6. I58 2009 analysis (10 copies on 1 week loan, 2 copies on 1 night loan) Exactly analysing Insertion- http://en.wikipedia.org/wiki/Introduction_to_Algorithms Sort Discrete mathematics Reading from CLRS for week 1 Chapter 1 Chapter 2.1, 2.2

  7. CS 270 Computational problems Algorithms Oliver Kullmann Organisation Computationa Computational Problem: A specification in general terms of problems and inputs and outputs and the desired input/output relationship. algorithms Problem Instance: An actual set of inputs for a given problem. Insertion sort Algorithm Example 1 analysis Exactly Problem: Sorting (numbers). analysing Insertion- Input: A sequence of n numbers � a 1 , a 2 , . . . , a n � . Sort Output: A permutation (reordering) � a ′ 1 , a ′ 2 , . . . a ′ n � Discrete mathematics of the input such that a ′ 1 ≤ a ′ 2 ≤ . . . ≤ a ′ n . Example instance: � 10 , − 15 , 3 , 3 , 70 , − 17 , − 30 � .

  8. CS 270 Computational problems Algorithms Oliver Kullmann Organisation Computationa Computational Problem: A specification in general terms of problems and inputs and outputs and the desired input/output relationship. algorithms Problem Instance: An actual set of inputs for a given problem. Insertion sort Algorithm Example 1 analysis Exactly Problem: Sorting (numbers). analysing Insertion- Input: A sequence of n numbers � a 1 , a 2 , . . . , a n � . Sort Output: A permutation (reordering) � a ′ 1 , a ′ 2 , . . . a ′ n � Discrete mathematics of the input such that a ′ 1 ≤ a ′ 2 ≤ . . . ≤ a ′ n . Example instance: � 10 , − 15 , 3 , 3 , 70 , − 17 , − 30 � .

  9. CS 270 Algorithmic solution Algorithms Oliver Kullmann Organisation Computationa problems Algorithm: a well-defined computational procedure that takes and algorithms some value, or set of values, as input and produces some Insertion values, or set of values, as output. sort Algorithm analysis A program is a particular implementation of some Exactly analysing algorithm. Insertion- A program is not the same as an algorithm. Sort Discrete There will always be many different algorithms for any mathematics given problem.

  10. CS 270 Algorithmic solution Algorithms Oliver Kullmann Organisation Computationa problems Algorithm: a well-defined computational procedure that takes and algorithms some value, or set of values, as input and produces some Insertion values, or set of values, as output. sort Algorithm analysis A program is a particular implementation of some Exactly analysing algorithm. Insertion- A program is not the same as an algorithm. Sort Discrete There will always be many different algorithms for any mathematics given problem.

  11. CS 270 Expressing algorithms Algorithms Oliver Kullmann We express algorithms in whatever way is the clearest and most concise. Organisation Computationa English is sometimes the best way. problems and algorithms When issues of control need to be made perfectly clear, we often Insertion use pseudocode. sort Algorithm analysis Pseudocode is similar to any typical imperative Exactly programming language, such as Java, C, Pascal, . . . analysing Insertion- Pseudocode is designed for expressing algorithms to Sort humans. Software engineering issues of data abstraction, Discrete mathematics modularity, error handling are often ignored. We sometimes embed English statements into pseudocode. Therefore, unlike for “real” programming language, we cannot create a compiler that translates pseudocode to machine code.

  12. CS 270 Expressing algorithms Algorithms Oliver Kullmann We express algorithms in whatever way is the clearest and most concise. Organisation Computationa English is sometimes the best way. problems and algorithms When issues of control need to be made perfectly clear, we often Insertion use pseudocode. sort Algorithm analysis Pseudocode is similar to any typical imperative Exactly programming language, such as Java, C, Pascal, . . . analysing Insertion- Pseudocode is designed for expressing algorithms to Sort humans. Software engineering issues of data abstraction, Discrete mathematics modularity, error handling are often ignored. We sometimes embed English statements into pseudocode. Therefore, unlike for “real” programming language, we cannot create a compiler that translates pseudocode to machine code.

  13. CS 270 Expressing algorithms Algorithms Oliver Kullmann We express algorithms in whatever way is the clearest and most concise. Organisation Computationa English is sometimes the best way. problems and algorithms When issues of control need to be made perfectly clear, we often Insertion use pseudocode. sort Algorithm analysis Pseudocode is similar to any typical imperative Exactly programming language, such as Java, C, Pascal, . . . analysing Insertion- Pseudocode is designed for expressing algorithms to Sort humans. Software engineering issues of data abstraction, Discrete mathematics modularity, error handling are often ignored. We sometimes embed English statements into pseudocode. Therefore, unlike for “real” programming language, we cannot create a compiler that translates pseudocode to machine code.

  14. CS 270 Expressing algorithms Algorithms Oliver Kullmann We express algorithms in whatever way is the clearest and most concise. Organisation Computationa English is sometimes the best way. problems and algorithms When issues of control need to be made perfectly clear, we often Insertion use pseudocode. sort Algorithm analysis Pseudocode is similar to any typical imperative Exactly programming language, such as Java, C, Pascal, . . . analysing Insertion- Pseudocode is designed for expressing algorithms to Sort humans. Software engineering issues of data abstraction, Discrete mathematics modularity, error handling are often ignored. We sometimes embed English statements into pseudocode. Therefore, unlike for “real” programming language, we cannot create a compiler that translates pseudocode to machine code.

  15. CS 270 Insertion Sort Algorithms Oliver Kullmann Example 2 Organisation Insertion Sort is a good algorithm for sorting a small number of Computationa problems elements. and algorithms It works the way you might sort a hand of playing cards. Insertion sort Insertion-Sort ( A ) Algorithm analysis 1 for j = 2 to A . length Exactly 2 key = A [ j ] analysing Insertion- 3 / Insert A [ j ] into sorted sequence A [1 . . j − 1]. / Sort 4 i = j − 1 Discrete mathematics 5 while i > 0 and A [ i ] > key 6 A [ i +1] = A [ i ] 7 i = i − 1 8 A [ i +1] = key

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend