Bubble sort is a fundamental sorting algorithm that repeatedly compares adjacent elements in an array and swaps them if they are in the wrong order, continuing this process until the entire array is sorted in ascending order. The algorithm requires n-1 passes for an array of n elements, with the largest element reaching its correct position in each pass. Virtual labs provide an accessible platform for students to learn and practice this algorithm through interactive simulations, allowing them to visualize the sorting process step-by-step using devices like smartphones, tablets, or computers with stable internet connections.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Demonstration of Simulation on Bubble Sort
Added:[music] [music] [music] >> Namaskar. Very warm welcome to all the viewers and learners in this live interaction of CIT NCERT based on virtual labs. I'm Renu Bhatt with you all and you are watching us live on PM e-Vidya channels from channel number 6 to 12. Now apart from all these channels, you are with us on our YouTube channels as well. That is ncertofficial and ncert PM e-Vidya class number 6 to 12. And dear viewers, as you can see I'm accompanied by our sign language interpreter. Let's meet her. You are Miss Anushka Sharma. Anushka, very warm welcome. And this session is for virtual labs and the topic that we're going to discuss today in this specific session is quite important. This uh The topic is demonstration of simulation on bubble sort and this session is for computer science 12 standard students.
And dear viewers, as you all know virtual labs are very much important these days and with the help of internet you can perform any uh experiment of yours at your convenience.
But what exactly virtual labs are and how you can perform your experiments and what is the navigation for that? We are joined by our expert to throw more light on this particular topic. So without any further delay, let's quickly meet him.
You are Mr. Harsh Madhav. You are consultant technical from CIT NCERT New Delhi. Very warm welcome, sir.
>> Good morning, sir.
>> And before we start this particular session, let me share some certain information to all the viewers out there. In case you have any query or you want to know more about virtual lab, you can reach out to us through our various mediums. We really want you to call us on our telephone number. It's a 8800440559.
Either you can drop your email address as well. Your all your feedbacks on our email address, that is [email protected].
And if you have joined us through our live streaming, then you have to go to the live chat box and then only you can drop your comments out there. Our expert will be more than happy to answer all your queries and doubts if you have any.
So, let's quickly start this session at and at the very beginning of this session, Harsh sir, we want you to tell us more about the virtual lab importance specifically in computer science subject.
>> So, virtual [clears throat] lab in computer science in terms of computer science like in many school or in many rural areas, it's still computer labs are not there.
>> Right.
>> So, for them, we need only a stable internet connection or any devices like mobile phones, smartphones, or tablets, or computer. So, that the student can perform their activity like the simulation things by using the mobile phone also and tablets also and with only the internet. So, it will be very convenient for all the students and the learners to understand the virtual lab simulation through the internet and the tablets and the other devices.
>> Okay. So, our viewers or all these students, they can perform they can use this platform on their mobile phone as well.
>> Yes, yes, ma'am.
>> Okay. So, now could you please explain about about our topic what we are going to discuss today?
>> So, today we we'll discuss the bubble sort. So, bubble sort is a basically a sorting technique. So, we will do the sorting till then when the numbers in the array is sorted in such a way that it will be arranged in a ascending order.
Like suppose, I will give you the example.
So, here I will give you the example.
>> Sure.
>> So let's take an array.
So right now I have taken four number 2413. So basically uh sorting bubble sorting will do it will check the first two number like it will compare right number from the left whether it is uh greater or smaller.
So and it will uh go to till n minus 1.
n minus 1 means the length. Here you can see the array is four number, but in array we count length as zero one two three. It means uh the length is zero one two three. It means there are four uh length.
So So we will go like this. Like uh four four minus one four minus one. It means that uh this passes the passes number of passes will go to is to three. So it will check first the two number like two four.
So you can see that uh two four is like two is less than four. So it is already arranged in a ascending order manner.
After that the next pass it will go.
>> Mhm.
>> So now it will check four one.
So you can see four is greater than one.
It is not arranged in a proper manner in a bubble sorting manner. So it will sort here. So again for the next step it will sort like this.
Now it will pass through the another level. It will check four three. You can see four is greater than three, the next number.
So now again it will sort it.
As you can see the greater number in this all four digit number like four is placed in a correct correct uh position.
So now we will again sort it.
Now we will check for this two number.
Now we will again sort this two number like two one it will check for two one.
So now we will check like uh two is greater than one so it will be swap the number.
Now after everything you can see the sorting bubble sorting is done completed. Now you can see one two three four is uh uh set it sorted in the ascending order so bubble sorting is completed here. So this is the reason bubble sort is a basically a sorting technique which is uh completed till the number is sorted in an ascending order.
So this is the example now I will go with the explanation part in the simulation thing.
>> Sure. So it might be possible there are some viewers who joined us for the first time they don't have any information about virtual labs. In that that case could you please tell them about the virtual labs where they can find these this platform and there must be so many questions in their mind right?
Is it free or is it open to all?
>> Yes yes. So it is free for all >> Mhm.
>> open for all actually. We just need to create an ID like with the help of the mail ID you can easily register on this Diksha portal. There is a Diksha portal actually diksha.gov.in.
So right now I will search here.
So if you hit this diksha.gov.in login >> Mhm.
>> So it will redirect to this page.
>> Okay.
>> You can see this is the home page of diksha.gov.in.
Here you can see multiple things are there. So, you have to little bit of scroll down here.
You can see the focus areas of Diksha.
So, here in the second option you can see virtual lab is there.
So, a student or any user have created the ID email ID with the help of email ID he or she can easily register to the Diksha portal and can access anytime anywhere from any place. So, by the help of only email ID he can login with the Diksha and access the virtual lab.
>> Okay.
>> Yeah.
>> So, is there any like sorting or like student for they have another account and for teacher they have other account.
Is that something?
>> Yes, yes, yes. Actually, while registering the in this portal it will ask like you are login as a what? Like as a teacher, as a faculty or as a individual >> So, they have their category >> yes, yes, yes.
>> Okay.
>> So, after the Diksha login when you click on the virtual lab it will be the home page will be appeared like this. In this you can see about the virtual lab explanation is there.
And you will little bit of scroll down you can see the virtual lab e-content.
Actually, it is separated by the class section. Virtual lab e-content is for class 6 to 12.
You can see from class 2 6 to 12 all the virtual labs according to the NCERT syllabus is stored in this portal.
So, right now I am going to I am explaining class grade 12 bubble sort topic. So, I am going here in the explore button. You have to click in the explore button.
You can see there are two medium. Like what in which language you want to understand this thing? Like in Hindi medium or English medium.
So, right now I am clicking on the English medium.
You can see the number of subjects which is in class 12 will appear here like mathematics, science, chemistry, biology and computer science.
So right now I'm my our topic is from computer science so I have clicking on computer science.
Yeah.
So this screen will appear here. You can see on the right hand side table of content is there. Like you can see it is this content is actually as per the NCERT syllabus and it is already aligned with the NCERT textbook.
So we have to search here you can see bubble sort is there.
So right now if you click on the bubble sort you can see there are two drop down is there. One is explanation resources and second is learning resources. So in explanation resources if you click here you can see the theory is there, procedure is there and self evaluation part is there.
So if if the if any user has logged in into the system into the Diksha portal and he want to understand like what what he or she want to perform today so he has to simply click on the theory.
So he can understand [clears throat] what the what he is going to perform today.
Like with the help of the theory you can see objective is here like implement a program that sort that given its list elements using bubble sort algorithm.
So if he want to understand what is bubble sort like before moving forward into the coding section part like he he will know the algorithm for the bubble sort like what is bubble sort. So by the help of this theory you can see here is definition is written for the bubble sort like bubble sort is a simple sorting algorithm that works by repeatedly swapping adjacent element if they are in the wrong order until the list is sorted.
The theory behind bubble sort can be summarized in the following steps.
Like it will compare the adjacent element as I am shown in the example.
Like it will uh the right right side value. If right side value is greater than uh from the left side value, then it will get swapped.
Till then when it is uh arranged in the ascending order, then the bubble sort sorting is fully completed.
So, after the theory part you can see procedure is there. So, if you click on the procedure you can see this this [clears throat] page will appear.
Like you can see the real life procedure is there.
And uh >> [clears throat] >> like what we are going to perform in the programming. Like it is a uh Python code is there. So, if the student is not able to understand the code Python code, so he can easily go through this procedure.
So, the student will get the idea to what what is ARR means, what is N equal to len means. Here you can see ARR is the array initialization.
N equal to length array. It means it it stored the array length of the blue variable N.
And swapped equal to false. So, every every thing will be explained here. Like in code you can see that the conditions are written like for condition, if condition, else condition. But user don't know why we are using it. So, he or she can go through this procedure to get the idea to why we are using this for, why we are using this if condition or else condition.
After that, in this procedure uh simulation procedure are also there.
Like suppose [clears throat] uh we have opened the simulation, but we don't know what to do next what to do next. In this simulation hint is there, but if user want to understand like what is step by step what we need to do in this simulation, so he will go through this simulation procedure. Here you can see the step by steps all things are written. Like first step is that select the variable to be tracked from the drop down list. The second step is to click on the start button to view the state diagram.
And the third step is to if you have clicked on the start button, then use the next and previous button to view the state diagram.
And after that in the fourth step, and this is the final step that click on the reset button when the state diagram is completed.
So, if any user has suppose if any user miss this video, so he can easily go through this simulation procedure like how to perform the simulation. So, by the help of the simulation procedure, any user can perform the simulation.
So, now I am moving forward to the simulation part. So, for simulation, the user has to click on this learning resources.
If you click on the learning resources, you can see that the simulation of the bubble sort is there. So, you have to the user has to needs to create click on this simulation bubble sort.
Then this screen will appear.
So, this is the simulation screen that user will get after clicking on that link. So, you can see bubble bubble sort learn sorting step by step.
So, you have to click on this simulation.
>> [snorts] >> If you will click on the simulation, the procedure that I have explained in this previous tab, so you can see the coding is the Python code is on the left-hand side, the visualization in the center, and the number that we have to write here like for the sorting is in the right panel.
So, before starting with the simulation, I will explain you this code. What is this code means?
So, in programming in Python programming, if the code is start from def bubble sort list one, it doesn't mean the code is restarting from this line.
So, here you can see there is a variable that is num list. So, it means in procedure also I have explained you that what is this mean.
We have to initialize the array first.
So, here you can see we have we have we are taking the array here.
Like you can see 8 7 13 1 -9 and 4.
These are the number that is taken in the array.
So, after that it will sort the array according to the uh its size and swept it in the ascending order.
So, right now I will take the number like any random number.
>> Sure.
>> So, So, after the taking any number, we have to take uh take the number by giving the space.
So, you have to click on the set array.
Then you can see on the visualization screen the number will appear here. As I told you the array length is I start from the zero. So, you can see two is assigned as zero, four is assigned as one, and one is assigned as two, and six is assigned as three, and eight is assigned as four. It means it is five length, but the starting uh length count in array is start from zero.
So, after that you can see on the left side of the panel in the programming code.
As I told you that the program is start from the array. So, you can see it is it get highlighted like num list is stored with 2 4 1 6 8. After that you have to click on the next step button to see the comparison like the first two number.
If you click on the next step, you can this see the sorted list bubble sort num list is stored.
After that it will store it will take the length of the array.
After that it will n minus one that I told you it will passes the passes will go to till n minus one. It means the length length minus one.
So, here right now the length is five, so five minus one until four pass it will go.
So, after that in for loop, you can see it is comparing like it is comparing list one is left side. Left side is compared with the right side and it will compare its left side is less than the right side.
If it is less than the right side then it is correct. If it is not then it will get swapped.
So you can see two four. Two is less than four. It means we don't need to swap it.
Now it will go for the next part.
You can see six eight.
Again pass one is completed. It means there is no need to uh swap any of the number. Again it will go for the second pass. Now you can see eight is eight is the largest number in this array list. So it is assigned in the last side. So it is fixed. So it is get marked with the green. It means it is fixed. Now it can't be changed.
Now we have to click on the next step button.
It will check two one. It means you can see two one it will check and you can see that one is get replaced by the two because one is lesser than two. That's why it gets swapped. Bubble sort means it is uh sorting is done till the numbers in the array list is assigned in a ascending order.
This is the bubble sort definition actually.
So you can see two is get replaced by the one because two is greater than one.
That's why.
Again it will check for the two four. It is satisfying the condition. Again it will check the four six and it is set.
Again you can see the second last uh second last position is fixed because six is in in a correct position because uh six is greater than all the three before number.
After that it will again check one two.
two four.
six eight. And you can see four is fixed. One two then it will check for one, four. One, two. Now you can see the sorting is completed. It is good till four passes because the length is uh four.
Because the length was five, it I I as I told you that it will go to the n minus one times of passes. So five minus one is four. That's why it goes for the four passes and you can see the sorting is completed here.
So if any student want to explore any new number like with the different numbers I like if any faculty has given the students some different number, so he the student can restart this this activity and type that here the another different number to check whether it is uh sorted in bubble sort is correctly or not.
So by this method the user can go through with this the simulation and perform the different activities and perform the different numbers for bubble sort and get the idea what is bubble sort by the help of the theory also, procedure also, and with the help of the simulation it will get the better idea.
Yeah.
>> Okay.
So any other features of virtual labs?
>> So after exploring through all the Diksha thing, like the theory thing, procedure thing, simulation thing, so student wants to know that like he is getting get expert on this thing or not.
So he will go with the self-evaluation part also. In this >> Okay.
>> virtual lab self-evaluation is also there.
So if you want if user want to test himself like he is uh under he understand the logic or not, so he will go with the simulation uh self-assessment part also.
>> Okay.
>> So for self-assessment in the learning resources >> [snorts] >> Yeah, you can see here self-evaluation bubble sort is there. If user will click on this, then this screen will appear.
>> Mhm.
>> So the activity, the theory the user has gone through on the basis of that only the questions will appear here.
So you can see like user will go through this question.
>> Mhm.
>> And if if any user has no idea like what is this question like after the first pass of the bubble sort is in ascending order, which elements reaches its correct position? So if student have not idea like what is a he will go to the hint also. There is a option of hint also.
>> Okay.
>> If he will click on hint this hint button, it it moves towards the end of the list.
It means if any user has go through the theory, procedure, simulation, everything, still get confused in the question of the questions, so he can use the help the hint button to get the idea about this concept of this question and easily solve this question.
So suppose I am clicking on the large element. After it will go to the next next question.
So simply like what will the result after comparing 9 and 3 in the bubble sort for ascending order?
So they will be swapped.
Because 9 is greater than 3.
>> Mhm.
>> So these are these are the question that use user will get. But this question is not from outside from this theory, procedure, or simulation part.
>> So randomly I am selecting right now.
>> Mhm.
>> So you can after the completion of all the questions, the user will get this report. Like how much marks he has a scored. Like you can see right now three out of 10.
And for each question answer correct answer is there and one line explanation is also there.
Like if any user has like see that why he it is incorrect.
>> Mhm.
>> So one line explanation is also there.
Like in second question you can see what is the minimum number of passes required in the bubble sort >> Mhm.
>> for a list of n elements. You can see user had marked n.
>> Mhm.
>> But the correct correct answer is n minus one.
>> Okay.
>> You can see that one-line explanation is also there like for n elements bubble sort requires n minus one passes.
>> Mhm.
>> As I told you that the length length is n. So as for the number of passes the uh for the array list uh the for bubble sort it will always go with n minus one.
It means the length minus one.
>> Mhm.
>> That number of passes will go for in the bubble sort coding programming.
>> Mhm.
>> So by this method user can go with the questions also like why it is incorrect, why it is correct. For correct answer also it will give the explanation as you can see in the first question that after the first pass of the bubble sort in ascending order which elements reaches its correct position. You can see the user have marked in the largest largest element that is option C.
For that for this question also explanation is also there like after the first pass the largest element reaches its correct position at the end of the list. So you can see by this method user can easily understand the concept and the logic for the bubble sort or for the any other topic related to any of the subject.
Yeah.
>> Thank you so very much for this wonderful explanation and at this very end of this program in a very short we want to know sir as we all know till now it's a student-centric platform, right?
So what about the teachers? How virtual labs can be helpful for teachers? Uh >> Yeah. So for teachers like for teachers uh teachers help they shall have given the theory part and the programming for all the students. But for every student is it is not like in some of the let's let's just take example of the rural areas. In rural areas computer lab is not there if they it is there like like very limited limited computer is there. Suppose two or three PCs there and the student are like 50 or 60.
>> Right.
>> So it will very difficult for the teachers also to like give the time for to all the time for to the system for all the students. So for them it uh we need they need only the stable internet connection and any devices not the only the PC. If any smartphone is also there, you can user can easily go with the smartphone. The teacher can give a smartphone or tablet to the students like go with the diksha.gov.in website and log it with your email ID and just log in with your email ID and go through any of the courses, any of the simulation, any of the subjects according to its own grade.
So for teachers also it is very beneficial like a student can understand the concepts very easily, very practically and without any harming each other. Let's let's take example for the chemistry. Like suppose for in chemistry lab many harmful gases, chemicals are there. So with the help of this virtual lab so without touching any harmful gases, chemical, anything a student can easily perform the activity and get the idea what is this chemical reaction is there, what is gas is there, everything.
>> Okay. So it's time for me to wrap up this session because we are running very short of time. So but before that let me thank our expert. Thank you so very much Harsh sir for being with us and for this a wonderful explanation of bubble sort.
So dear viewers, as you know virtual labs are for you only. This platform is new for you only and you can learn a lot more things in virtual lab at your convenience, according to your pace. And thank you so very much Anushka as well. And before I wrap up this session let me share about sessions as well for you all.
Uh At 11:00 we will be back with our another live interaction named ULLAS.
The topic would be redefining literacy beyond reading and writing and rest of the programs are in front of you. We want you to join all in all our sessions. And me, Renu Bhatt, along with my whole team is taking your leave, but you stay tuned to PM e-Vidya channel for more informative programs. Namaskar.
>> [music]
Related Videos

TOP 15 Data compression Interview Questions and Answers 2019 Part-2 | Data compression | Wisdom jobs
wisdomjobs
281 views•2019-06-28

CTS 158: 802.11w Management Frame Protection
ClearToSend
4K views•2019-02-04

NDSS 2019 Send Hardest Problems My Way: Probabilistic Path Prioritization for Hybrid Fuzzing
NDSSSymposium
496 views•2019-04-02

How realistic is Cities: Skylines?
CityBeautiful
159K views•2019-02-14

GUIs & TUIs: Choosing a User Interface for Your Python Project | Real Python Podcast
realpython
2K views•2025-04-04

The OSI Model - Explained by Example
hnasr
225K views•2019-05-12

Cloud Computing - Introduction
elithecomputerguy
98K views•2019-10-07

From Traveler's Dilemma to Dynamic Routing | Demystifying Networking
IITBombayJuly
5K views•2019-08-04
Trending

we're almost finished the house (ep.125)
JennaPhipps
347K views•2026-07-22

We Finally Know Where Saturn’s Rings Came From
astrumspace
79K views•2026-07-22

BIG BET: Cathie Wood goes ALL IN on Elon Musk
FoxBusiness
89K views•2026-07-22

MIC DROP: Smithsonian Director Called Out For Woke Propaganda
TheAmalaEkpunobi
37K views•2026-07-23