0% found this document useful (0 votes)
2 views3 pages

Sorting Algorithms: Basics and Examples

The document explains sorting algorithms, which reorder lists of values either numerically or alphabetically. It provides a simple sorting program example in Python, demonstrating how to sort letters and numbers, as well as how to perform reverse sorting. Code snippets are included for both standard and reverse sorting operations.

Uploaded by

nebiyu-daniel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Sorting Algorithms: Basics and Examples

The document explains sorting algorithms, which reorder lists of values either numerically or alphabetically. It provides a simple sorting program example in Python, demonstrating how to sort letters and numbers, as well as how to perform reverse sorting. Code snippets are included for both standard and reverse sorting operations.

Uploaded by

nebiyu-daniel
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Sorting algorithm

Week 2
Sorting algorithm
 A sorting algorithm reorders a list of values into the order required.
Most sorts are numerical or alphabetical.

A simple sorting program (to be performed on


pydroid)
1. letters=[“R”,”Y”,”D”,”B”,”W”,”A”]
[Link]()
print(letters)
2. numbers=[54,5,98,1,45,68]
[Link]()
print(numbers)
How to do reverse sorting
 1. letters=[“R”,”Y”,”D”,”B”,”W”,”A”]
[Link](reverse=True)
print(letters)

 2. numbers=[54,5,98,1,45,68]
[Link](reverse=True)
Print(numbers)

You might also like