Screenshot 2024-09-09 at 11.10.48 AM
Screenshot 2024-09-09 at 11.10.48 AM
L.O.:
What is an
algorithm?
Plenary:
Sorting in real life is all about organizing information, tasks, or objects in a way that makes
them easier to access or use.
real-life situations:
• Arranging groceries on shelves by category (dairy, fruits, vegetables) or price.
• Sorting emails in your inbox based on priority, sender, or date.
• Organizing books in a library or home bookshelf by title, author, or genre.
• Preparing ingredients in the correct order for a recipe.
• Taking attendance in class, where names are arranged alphabetically or by roll number.
• Managing a to-do list or calendar by task priority or deadline.
• Organizing guests at a wedding or event by table number or name
• Sorting students' test papers by score or grade.
o Sorting algorithm specifies the way to arrange data in a particular order.
o Most common orders are in numerical or lexicographical order(dictionary order or
alphabetical order).
o The importance of sorting lies in the fact that data searching can be optimized
to a very high level, if data is stored in a sorted manner.
o Sorting is also used to represent data in more readable formats.
Watch the video below and discuss the following:
o How many numbers were there?
o Is there any relation between number of items and iterations?
o Is it possible to have iterations from descending to ascending as well?
o Can you try with the following numbers : 89, 32, 98.
o Bubble Sort
o Activity :
o Page no: 4; Question no: 5.
o Activity :
o Page no: 5, Question no: 6, 7
• Try Bubble sort on the following: 5, 3, 4, 2.
• Try Bubble Sort on the following numbers:7, 6, 4, 3.
oHomework
• Try Bubble sort on the following numbers in both ascending and descending
order:
o 23, 56, 11, 44, 22, 98
Write WWW,
EBI in your
workbook.
Bubble sort - Pseudocode
This tells the algorithm to run until the list of values
WHILE list is unsorted DO is sorted.
FOR n items in list DO For each of the items in the list, carry out the
instructions below.
IF n > n+1
THEN swap items
If the first value in the list is larger than the following
END IF
item, swap the items.
END FOR
Continue until all items have been compared.
END WHILE
Page Number 6,7 ; Question number: 2,3,4,5,6,7 Support :- Page number: 13, 15, 21
Plenary: