CLASS: XII SUBJECT: Computer Science
UNIT: 1 LESSON: Review of Class XI (Sorting Algorithms) No of session required: 1
Sessio Gist of Lesson Expected Learning Teaching Suggested material / Assessment Worksheets
n Outcomes/ELO Learning Resources strategies
activities planned planned/Assignments
/Practical
1 Sorting Student will be able to Sorting means to Bubble and Insertion
Algorithms: understand the arrange the sorting algorithms
contents of the list and calculating the Link to the
-Bubble Sort in ascending or number of operations worksheets
-Insertion Sort >>Concept of sorting descending order. is explained in the
following video. Practical
+ Bubble sort Bubble and demonstration Worksheet:1
Insertion sort is
Count number of + Insertion Sort explained in the https://
operation while following PPT Link to topic www.loom.com/
sorting explanation in word share/ Worksheet:2
format 27c891fe15254a41a2
>>Count the total
number of operations Number of https:// 5539e68cab7a02
in bubble and operations in a drive.google.com/
insertion sort program effects file/d/
the efficiency of 1ESTCWdknAM1Rc
the program XFrjIk_MTRT30pEK
yeO/view?
usp=sharing Program of Bubble
Sort
Link to PPT
https:// Link to the video of Program of Insertion
drive.google.com/ the topic Sort
file/d/
1vXi2covXuepIH https://
rTz9gOaKVptHq www.loom.com/
iigDq1/view? share/
usp=sharing a384775871904de683
a2cfeb279a72b0
WORKSHEET 1
1 Why do number of comparisons reduce in every successive iteration in Bubble sort?
2 On which basis you can determine if an algorithm is efficient or not?
3 Write a program to perform insertion sort on a list of numbers. Create the list by accepting values from the user.
4 What will be the status of following list after fourth iteration of bubble sort in ascending order?
93, 10, 34, -2, 16, 83, 26
WORKSHEET 2
1. What is sorting? Name some sorting techniques.
2. Given a list 34,56,7,2,0,8 Sort the list in ascending order using bubble sort. Show the contents of the list after each
pass.
3.
Carefully examine the image and identify which sorting algorithm is used to sort
the list
4. Differentiate between insertion and bubble sort.
PROGRAMS OF BUBBLE AAND INSERTION SORT
#BUBBLE SORT
def bubble(): #Function
l=[27,4,15,3,5,19,10,2,1] #list
print("Original List:", l,'\n')
n=len(l) #store number of elements in n
for i in range(n-1): #outer for loop
for j in range(n-1-i): #inner for loop
if l[j] > l[j+1]:
l[j],l[j+1] = l[j+1],l[j] #swapping
print("List after pass", i+1,":", l)
print("List after sorting:", l)
#INSERTION SORT
def insertion(): #Function
l=[27,4,15,3,5,19,10,2,1] #list
print("Original List:", l,'\n')
n=len(l) #store number of elements in n
for i in range(1,n): #outer for loop
j=i
while j>0: #inner loop
if l[j-1] > l[j]:
l[j-1],l[j] = l[j],l[j-1] #swapping
else:
break
j=j-1
print("List after pass", i,":", l)
print("List after sorting:", l)