Your SlideShare is downloading.
×

×
Saving this for later?
Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.

Text the download link to your phone

Standard text messaging rates apply

Like this presentation? Why not share!

- Introduction to algorithms by Dr Sandeep Kumar ... 234 views
- Selection sort 1 by HemuNemo 493 views
- Sorting bubble-sort anim by Fajar Zain 956 views
- Selection sort by smlagustin 1399 views
- Data Structures - Lecture 8 [Sortin... by Muhammad Hammad W... 187 views
- Quadratic Functions by ingroy 3647 views

No Downloads

Total Views

1,120

On Slideshare

0

From Embeds

0

Number of Embeds

2

Shares

0

Downloads

0

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Algorithms
- 2. Starter Activity: Crossing Water Open the ‘Crossing Water’ activity. It is in the Getting Technical folder in Groupwork. ‘You need to help the adults and children cross the water but they can’t all go in the boat together. Algorithms
- 3. In this lesson you will learn about algorithms and how computers use them. You will write a simple algorithm, perform a simple and selection sort and determine which one is the most efficient. Lesson Objectives Understand the purpose of an algorithm Be able to create simple algorithms using English Be able to complete simple and selection sorts Be able to compare algorithms for efficiency Algorithms
- 4. Algorithms Watch the Algorithms video, this will introduce you to how algorithms works. Algorithms
- 5. Algorithms •An algorithm is a precise set of instructions for completing a task •Every time you follow a series of step by step actions you are using an algorithm •Starting a car, getting dressed, logging into your computer are all completed using an algorithm •Computers use algorithms that people have written to solve all kinds of tasks for example to search for documents or to sort your documents Algorithms
- 6. Example Algorithm Here is an algorithm for making a pot of tea: 1.If the kettle does not contain water then fill the kettle 2.Plug the kettle into the plug socket and turn on 3.If the teapot is not empty then empty teapot 4.Place tea bag in the teapot 5.If the water in the kettle is not boiling then go to step 5 6.Switch the kettle off 7.Pour water from the kettle into the teapot Algorithms
- 7. Task 9: Ice Lolly Algorithm Write an algorithm for making ice lollies out of water and fruit cordial. Algorithms
- 8. Simple Sort Algorithm Watch the Simple Card Sort animation, this will illustrate a simple sort algorithm. Algorithms
- 9. Task 10: Simple Card Sort 1.You will be given a hand of unsorted cards 2.Repeat steps 3 through 5 until the unsorted hand is empty 3.Compare unsorted cards 4.Select the smallest unsorted card 5.Move this card to the sorted hand 6.Stop Algorithms
- 10. Computer - Simple Card Sort Computers will carry out similar sorts but with numbers rather than cards. The computer would find the smallest number and then copy it to a new list called an array. The original number would be replaced with a special number called MAX. No number can be greater than MAX. This process would be repeated until all the numbers have been considered and the array was sorted. Algorithms
- 11. Selection Sort Algorithm Watch the Selection Card Sort animation, this will illustrate a selection sort algorithm. Algorithms
- 12. Task 11: Selection Card Sort 1.You will be given a hand of unsorted cards 2.Use a pen to set a marker for the unsorted section at the front of the hand 3.Repeat steps 4 through 7 until one card remains in the unsorted section 4.Compare all unsorted cards 5.Select the smallest unsorted card 6.Swap this number with the first card in the unsorted section 7.Advance the marker to the right one card 8.Stop Algorithms
- 13. Computer - Selection Sort The computer would add a marker at the beginning of the array of unsorted numbers. To sort the numbers, the computer would repeatedly search the unsorted section for the smallest number, swap this number with the first number in the unsorted section and advance the sort marker. This process would be repeated until there was only one number in the unsorted section. At this point the list of numbers will be sorted. Algorithms
- 14. Efficiency of Algorithms The efficiently of algorithms can be measured by calculating: 1.The amount of memory they use 2.The amount of copying, comparing and swapping of numbers Algorithms
- 15. Which Sort Algorithm is the Best? 1.As the selection sort swaps the numbers rather than copying them into a new list it uses memory than the simple sort. 2.Since the simple sort does not swap numbers it would perform the least number of copies however, it would perform twice as many comparisons as the selection sort. 3.It is difficult to say which algorithm is the best as it all depends on the original list, because of this algorithms are measured on a worst case basis. Algorithms
- 16. Task 12: Most Efficient Algorithm Analyse the figures below to find out which sort is the most efficient. The figures are all based on worst case. Write-up your findings and justify your decision. Algorithms No of Items Simple Selection 10 90 45 100 9,900 4,950 1000 999,000 499,500 10000 99,990,000 49,995,000 No of Items Simple Selection 10 10 27 100 100 297 1000 1,000 2,997 10000 10,000 29,997 Copies RequiredComparisons Required
- 17. Plenary: Alien Message Write a short message to an alien explaining what you have learnt in todays lesson. They only understand basic English so think carefully about the terminology you use. Algorithms
- 18. Keywords Understand the purpose of an algorithm Be able to create simple algorithms using English Be able to complete simple and selection sorts Be able to compare algorithms for efficiency Objectives Algorithm Instructions Sort Array Marker Memory Simple Selection Algorithms

Be the first to comment