Download presentation
Presentation is loading. Please wait.
Published byElaine Horn Modified over 9 years ago
1
Lists in Python Selection Sort Algorithm
2
Sorting A very common activity for computers Not just in business, sorting is used in databases, graphics, simulations, games, etc. Many different algorithms for sorting – different ones are better for sorting data in different formats, environments, conditions Python has a sort algorithm builtin, for lists
3
So why learn a sort algorithm? Good exercise for manipulating lists Not all languages have one builtin Why selection sort? – one of the simpler algorithms – easy to debug if necessary
4
Selection sort for n elements (ascending) for n-1 passes find the largest value in unsorted part of list swap it with the value at the end of the unsorted part There are variations based on using smallest instead of largest, on descending instead of ascending
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.