title
Sorting - Part 1 | Selection Sort, Bubble Sort, Insertion Sort | Strivers A2Z DSA Course
description
Book a FREE career counseling session with Learnbay: https://bit.ly/3km2s6W
@Learnbay is an established EdTech platform with expertise in Data Science & AI and Full-Stack Development courses headquartered in Bengaluru.
They offer several IBM-certified Data Science courses. Since 2015, Learnbay has helped 10,000+ people to have a successful safe career transition.
Follow Learnbay platforms to stay connected for the latest updates & information: https://linktr.ee/Learnbay
#Learnbay #learnbaycourse #learnbayreview #learnbaydatascience #learnbaycoursereview #learnbaydatasciencecoursereview #learnbayfullstack
Notes/C++/Java/Python Codes:
Selection sort: https://takeuforward.org/sorting/selection-sort-algorithm/
Bubble Sort: https://takeuforward.org/data-structure/bubble-sort-algorithm/
Insertion Sort: https://takeuforward.org/data-structure/insertion-sort-algorithm/
Full Course: https://takeuforward.org/strivers-a2z-dsa-course/strivers-a2z-dsa-course-sheet-2/
You can follow me across social media, all my handles are below:
Linkedin/Instagram/Telegram: https://linktr.ee/takeUforward
0:00 Intro
2:45 - Selection Sort
6:50 - Pseudo code / implementation for Selection Sort
14:28 - C++ code for selection sort
17:41 - Bubble Sort
22:00 - Pseudo code / implementation for Bubble Sort
25:52 - C++ code for bubble sort
31:40 - Insertion Sort
36:55 - Pseudo code / implementation for Insertion Sort
38:52 - C++ code for Insertion Sort
detail
{'title': 'Sorting - Part 1 | Selection Sort, Bubble Sort, Insertion Sort | Strivers A2Z DSA Course', 'heatmap': [{'end': 976.048, 'start': 918.203, 'weight': 0.761}, {'end': 1078.524, 'start': 1045.367, 'weight': 0.832}, {'end': 2259.136, 'start': 2204.374, 'weight': 0.785}], 'summary': 'The strivers a2z dsa course offers 456 modules emphasizing sorting techniques for placements, with live online classes, industry-based capstone projects certified by ibm, and three years of subscription and 100% job assistance with hikes up to 250. it covers selection sort, bubble sort, and insertion sort algorithms, explaining their processes, time complexities, optimizations, and implementations with examples and steps provided.', 'chapters': [{'end': 156.717, 'segs': [{'end': 33.589, 'src': 'embed', 'start': 3.319, 'weight': 0, 'content': [{'end': 4.601, 'text': 'Hey everyone, welcome back to the channel.', 'start': 3.319, 'duration': 1.282}, {'end': 6.102, 'text': 'I hope you guys are doing extremely well.', 'start': 4.621, 'duration': 1.481}, {'end': 10.327, 'text': 'So this will be another lecture from the Strivers A2Z DSA course.', 'start': 6.543, 'duration': 3.784}, {'end': 18.057, 'text': "Just in case you're for the first time here, this course is India's most, yes, most in-depth course on DS Algo.", 'start': 10.848, 'duration': 7.209}, {'end': 20.64, 'text': 'Why do I say that? The course has 456 modules.', 'start': 18.117, 'duration': 2.523}, {'end': 24.121, 'text': 'you can go to the market.', 'start': 22.62, 'duration': 1.501}, {'end': 27.704, 'text': 'buy any of the paid courses, check out any of the free courses.', 'start': 24.121, 'duration': 3.583}, {'end': 33.589, 'text': 'none of those courses on ds algo will have 456 problems or modules.', 'start': 27.704, 'duration': 5.885}], 'summary': 'Strivers a2z dsa course offers 456 in-depth modules on ds algo.', 'duration': 30.27, 'max_score': 3.319, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS243319.jpg'}, {'end': 77.038, 'src': 'embed', 'start': 50.08, 'weight': 2, 'content': [{'end': 56.603, 'text': 'now the step two states you have to learn important sorting techniques in order to start your journey with ds algo.', 'start': 50.08, 'duration': 6.523}, {'end': 60.985, 'text': "sorting is something which you have to know, even if you're going for placements.", 'start': 56.603, 'duration': 4.382}, {'end': 66.448, 'text': 'they might ask you sorting algorithms and the sorting one, which is step 2.1.', 'start': 60.985, 'duration': 5.463}, {'end': 71.473, 'text': 'we have three algorithms selection sort, bubble shot, insertion sort.', 'start': 66.448, 'duration': 5.025}, {'end': 77.038, 'text': 'so if you are appearing for placements, they might ask you hey, can you please tell me the code for insertion sort?', 'start': 71.473, 'duration': 5.565}], 'summary': 'Learn sorting techniques for ds algo. topics include selection, bubble, and insertion sort. essential for placements.', 'duration': 26.958, 'max_score': 50.08, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS2450080.jpg'}, {'end': 117.731, 'src': 'embed', 'start': 89.85, 'weight': 1, 'content': [{'end': 95.636, 'text': 'So LearnBay is an edtech platform that offers you data science and full stack development programs dedicated to professionals only.', 'start': 89.85, 'duration': 5.786}, {'end': 103.523, 'text': 'So at LearnBay you will be getting 100% live online classes where you can interact with the faculties directly and get your doubt resolved one is to one.', 'start': 95.716, 'duration': 7.807}, {'end': 111.809, 'text': "One thing I did like about LearnBay is you'll be getting an opportunity to work on industry-based capstone projects which will be certified by ibm.", 'start': 103.923, 'duration': 7.886}, {'end': 117.731, 'text': "so you're going to get a global accreditation which will be beneficial whenever you present that project anywhere.", 'start': 111.809, 'duration': 5.922}], 'summary': 'Learnbay offers 100% live online classes and industry-based capstone projects certified by ibm for data science and full stack development programs.', 'duration': 27.881, 'max_score': 89.85, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS2489850.jpg'}, {'end': 143.447, 'src': 'embed', 'start': 119.692, 'weight': 3, 'content': [{'end': 127.776, 'text': 'you also get in one is to one personal mentorship and you also get a one is to one daily doubt session where you can actually get all your doubts resolved.', 'start': 119.692, 'duration': 8.084}, {'end': 133.479, 'text': 'also, they have project innovation labs across the country in kolkata, punya, bangalore, hyderabad and a lot of other places.', 'start': 127.776, 'duration': 5.703}, {'end': 137.342, 'text': 'so you can go over there and create your projects in the offline mode as well,', 'start': 133.479, 'duration': 3.863}, {'end': 143.447, 'text': 'once you enroll for any of the courses your three years of subscription so you can have all the learning modules and all the videos for three years.', 'start': 137.342, 'duration': 6.105}], 'summary': 'Enroll for courses to get 1:1 mentorship, doubt sessions, and 3 years of subscription, with project labs in kolkata, pune, bangalore, hyderabad, and more.', 'duration': 23.755, 'max_score': 119.692, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24119692.jpg'}], 'start': 3.319, 'title': 'Strivers a2z dsa: sorting techniques', 'summary': "Covers the comprehensive strivers a2z dsa course with 456 modules, emphasizing the significance of sorting techniques for placements. it introduces learnbay's data science and full stack development programs with live online classes, industry-based capstone projects certified by ibm, and offers three years of subscription and 100% job assistance with hikes up to 250.", 'chapters': [{'end': 156.717, 'start': 3.319, 'title': 'Strivers a2z dsa: sorting techniques', 'summary': "Covers the comprehensive strivers a2z dsa course with 456 modules, focusing on the importance of sorting techniques for placements, and introduces learnbay's data science and full stack development programs with live online classes and industry-based capstone projects certified by ibm, offering three years of subscription and 100% job assistance with hikes up to 250.", 'duration': 153.398, 'highlights': ["The Strivers A2Z DSA course is India's most comprehensive course on DS Algo with 456 modules, making it the most in-depth course on DS Algo in India.", 'Step two of the course introduces important sorting techniques which are essential for placements, covering three algorithms: selection sort, bubble shot, and insertion sort.', 'LearnBay offers data science and full stack development programs with 100% live online classes, industry-based capstone projects certified by IBM, three years of subscription, and 100 job assistance with hikes up to 250 by partnering with more than 250 companies like UI, Intel, SAP, and others.', 'One-on-one personal mentorship and daily doubt sessions are also provided by LearnBay, along with project innovation labs across the country in Kolkata, Pune, Bangalore, Hyderabad, and other places, offering an opportunity to work on projects in offline mode as well.']}], 'duration': 153.398, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS243319.jpg', 'highlights': ["The Strivers A2Z DSA course is India's most comprehensive course on DS Algo with 456 modules, making it the most in-depth course on DS Algo in India.", 'LearnBay offers data science and full stack development programs with 100% live online classes, industry-based capstone projects certified by IBM, three years of subscription, and 100 job assistance with hikes up to 250 by partnering with more than 250 companies like UI, Intel, SAP, and others.', 'Step two of the course introduces important sorting techniques which are essential for placements, covering three algorithms: selection sort, bubble shot, and insertion sort.', 'One-on-one personal mentorship and daily doubt sessions are also provided by LearnBay, along with project innovation labs across the country in Kolkata, Pune, Bangalore, Hyderabad, and other places, offering an opportunity to work on projects in offline mode as well.']}, {'end': 387.27, 'segs': [{'end': 183.341, 'src': 'embed', 'start': 156.717, 'weight': 7, 'content': [{'end': 160.7, 'text': 'learnbase, albinies have also got placed in top companies like amazon, tcl, capgemini, etc.', 'start': 156.717, 'duration': 3.983}, {'end': 161.681, 'text': 'so what are you waiting for?', 'start': 160.7, 'duration': 0.981}, {'end': 163.022, 'text': "there's a link in the description.", 'start': 161.761, 'duration': 1.261}, {'end': 164.384, 'text': 'click it and get your free.', 'start': 163.022, 'duration': 1.362}, {'end': 166.405, 'text': 'one is to one career counseling session.', 'start': 164.384, 'duration': 2.021}, {'end': 170.589, 'text': 'the question what is selection sort?', 'start': 166.405, 'duration': 4.184}, {'end': 174.053, 'text': 'does the name recommends selection?', 'start': 170.589, 'duration': 3.464}, {'end': 175.534, 'text': 'what do you select?', 'start': 174.053, 'duration': 1.481}, {'end': 178.397, 'text': 'we select minimums.', 'start': 175.534, 'duration': 2.863}, {'end': 181.9, 'text': 'remembers. as the name recommends, what do you select?', 'start': 178.397, 'duration': 3.503}, {'end': 183.341, 'text': 'we select minimums.', 'start': 181.9, 'duration': 1.441}], 'summary': 'Learnbase albinies placed in top companies like amazon, tcl, capgemini. get free one-on-one career counseling session.', 'duration': 26.624, 'max_score': 156.717, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24156717.jpg'}, {'end': 257.608, 'src': 'embed', 'start': 228.377, 'weight': 5, 'content': [{'end': 230.138, 'text': 'they place it at the first.', 'start': 228.377, 'duration': 1.761}, {'end': 233.698, 'text': 'whoever is at the first goes to that minimum.', 'start': 230.138, 'duration': 3.56}, {'end': 234.538, 'text': 'simple as that.', 'start': 233.698, 'duration': 0.84}, {'end': 241.1, 'text': 'so swapping, select minimums and swap is what the algorithm is all about.', 'start': 234.538, 'duration': 6.562}, {'end': 241.96, 'text': 'so this is step one.', 'start': 241.1, 'duration': 0.86}, {'end': 244.16, 'text': 'remember this, this is step one.', 'start': 241.96, 'duration': 2.2}, {'end': 245.04, 'text': 'what is step two?', 'start': 244.16, 'duration': 0.88}, {'end': 245.961, 'text': "let's see.", 'start': 245.04, 'duration': 0.921}, {'end': 253.302, 'text': 'so the step two states okay, i know the first, i know the extreme, smallest guy is at the first.', 'start': 245.961, 'duration': 7.341}, {'end': 257.608, 'text': 'now we should select the next minimum.', 'start': 254.167, 'duration': 3.441}], 'summary': 'Algorithm involves selecting and swapping minimum values at each step.', 'duration': 29.231, 'max_score': 228.377, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24228377.jpg'}, {'end': 387.27, 'src': 'embed', 'start': 287.436, 'weight': 0, 'content': [{'end': 288.877, 'text': 'And the rest remains as it is.', 'start': 287.436, 'duration': 1.441}, {'end': 291.458, 'text': 'Perfect Step 2 done.', 'start': 290.178, 'duration': 1.28}, {'end': 293.76, 'text': "Let's do step 3.", 'start': 291.919, 'duration': 1.841}, {'end': 298.964, 'text': 'So can I say, after 2 steps, I got the first 2 minimums.', 'start': 293.76, 'duration': 5.204}, {'end': 302.306, 'text': 'And this portion of the array is sorted.', 'start': 299.824, 'duration': 2.482}, {'end': 302.746, 'text': 'I can.', 'start': 302.406, 'duration': 0.34}, {'end': 305.328, 'text': 'Now we are left with this portion.', 'start': 303.287, 'duration': 2.041}, {'end': 308.03, 'text': 'What to do? Get the next minimum.', 'start': 306.289, 'duration': 1.741}, {'end': 311.611, 'text': "Who's the next minimum? 20.", 'start': 308.39, 'duration': 3.221}, {'end': 313.072, 'text': 'As usual, 930 stays.', 'start': 311.611, 'duration': 1.461}, {'end': 314.813, 'text': '20 comes in.', 'start': 314.373, 'duration': 0.44}, {'end': 320.296, 'text': 'If 20 is coming in here, where will 24 go? 24 will go to 20.', 'start': 315.633, 'duration': 4.663}, {'end': 321.697, 'text': 'So, take it to there.', 'start': 320.296, 'duration': 1.401}, {'end': 323.638, 'text': 'And 50 to 46 stays.', 'start': 322.317, 'duration': 1.321}, {'end': 325.419, 'text': 'Step 3 is completed.', 'start': 323.658, 'duration': 1.761}, {'end': 328.481, 'text': "Let's do step 4.", 'start': 326.159, 'duration': 2.322}, {'end': 332.963, 'text': 'At step 4, can you say that this portion of the array is sorted? You can.', 'start': 328.481, 'duration': 4.482}, {'end': 335.625, 'text': 'Which portion is not? This one.', 'start': 333.664, 'duration': 1.961}, {'end': 339.954, 'text': 'So, in this, which is the minimum? 24.', 'start': 336.212, 'duration': 3.742}, {'end': 341.455, 'text': 'Place it.', 'start': 339.954, 'duration': 1.501}, {'end': 342.135, 'text': '9, 13, 20, 24.', 'start': 341.475, 'duration': 0.66}, {'end': 344.977, 'text': '52 goes at its place.', 'start': 342.136, 'duration': 2.841}, {'end': 348.44, 'text': "46 Let's do the step 5.", 'start': 345.878, 'duration': 2.562}, {'end': 352.722, 'text': 'So, can I say at step 4, this is sorted and this is unsorted.', 'start': 348.44, 'duration': 4.282}, {'end': 354.523, 'text': 'Who is the minimum? 46.', 'start': 353.163, 'duration': 1.36}, {'end': 354.923, 'text': 'So, 9, 13, 20, 24.', 'start': 354.523, 'duration': 0.4}, {'end': 357.205, 'text': 'Sorry 46 will come here.', 'start': 354.924, 'duration': 2.281}, {'end': 358.306, 'text': 'And 52 will go here.', 'start': 357.305, 'duration': 1.001}, {'end': 373.086, 'text': 'Now At step 5, if this is done, do you need to? look like do you need to sort one element?', 'start': 358.366, 'duration': 14.72}, {'end': 375.126, 'text': 'one element will always be sought.', 'start': 373.086, 'duration': 2.04}, {'end': 382.729, 'text': 'so apparently, can i say the entire array is sorted at step five one, two, three, four, five, six, six elements.', 'start': 375.126, 'duration': 7.603}, {'end': 387.27, 'text': 'but actually took five steps to sort the entire array.', 'start': 382.729, 'duration': 4.541}], 'summary': 'Sorted an array of 6 elements in 5 steps.', 'duration': 99.834, 'max_score': 287.436, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24287436.jpg'}], 'start': 156.717, 'title': 'Array sorting techniques', 'summary': 'Covers the selection sort algorithm and array sorting in steps, with examples and steps provided. it explains the process of sorting an array by finding the minimum values and placing them in order, and after 5 steps, the entire array of 6 elements is sorted.', 'chapters': [{'end': 257.608, 'start': 156.717, 'title': 'Understanding selection sort algorithm', 'summary': 'Explains the selection sort algorithm, which involves selecting the minimum element from the array and placing it at the beginning, followed by selecting the next minimum element, with examples and steps provided.', 'duration': 100.891, 'highlights': ['The selection sort algorithm involves selecting the minimum element from the entire array and placing it at the first position, followed by placing the subsequent elements accordingly.', 'Alumni of learnbase have secured placements in top companies such as Amazon, TCL, and Capgemini, showcasing the effectiveness of the career counseling sessions.', 'The algorithm involves swapping elements based on their minimum values, with step-by-step explanations provided for each stage of the process.']}, {'end': 387.27, 'start': 257.608, 'title': 'Array sorting in steps', 'summary': 'Explains the process of sorting an array by finding the minimum values and placing them in order, and after 5 steps, the entire array of 6 elements is sorted.', 'duration': 129.662, 'highlights': ['The entire array is sorted at step five, with six elements, but it took five steps to sort the entire array.', 'After 2 steps, the first 2 minimums are obtained, and that portion of the array is sorted.', 'After 2 steps, 13 becomes the minimum, and 46 is placed after 13, with the rest remaining as it is.', 'After 3 steps, 20 becomes the next minimum, and 24 is placed after 20, while 50 remains after 46.', 'After 4 steps, 24 becomes the minimum, and 52 is placed after 24.']}], 'duration': 230.553, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24156717.jpg', 'highlights': ['The entire array is sorted at step five, with six elements, but it took five steps to sort the entire array.', 'After 4 steps, 24 becomes the minimum, and 52 is placed after 24.', 'After 3 steps, 20 becomes the next minimum, and 24 is placed after 20, while 50 remains after 46.', 'After 2 steps, 13 becomes the minimum, and 46 is placed after 13, with the rest remaining as it is.', 'After 2 steps, the first 2 minimums are obtained, and that portion of the array is sorted.', 'The selection sort algorithm involves selecting the minimum element from the entire array and placing it at the first position, followed by placing the subsequent elements accordingly.', 'The algorithm involves swapping elements based on their minimum values, with step-by-step explanations provided for each stage of the process.', 'Alumni of learnbase have secured placements in top companies such as Amazon, TCL, and Capgemini, showcasing the effectiveness of the career counseling sessions.']}, {'end': 1054.793, 'segs': [{'end': 434.883, 'src': 'embed', 'start': 387.27, 'weight': 1, 'content': [{'end': 392.772, 'text': 'what i did was get the minimum and swap it and swap it.', 'start': 387.27, 'duration': 5.502}, {'end': 396.413, 'text': 'then what i did was get the minimum and swap it.', 'start': 392.772, 'duration': 3.641}, {'end': 399.634, 'text': 'then what i did was get the minimum and swap it.', 'start': 396.413, 'duration': 3.221}, {'end': 404.212, 'text': 'So get the minimum and swap is the algorithm.', 'start': 400.469, 'duration': 3.743}, {'end': 411.418, 'text': "Now the question comes okay, we've understood the algorithm, but how do I implement this in code?", 'start': 405.013, 'duration': 6.405}, {'end': 417.222, 'text': "I'll be writing the pseudo code so that you can write it in C++ as well as in Java, as well as in Python.", 'start': 411.818, 'duration': 5.404}, {'end': 422.746, 'text': 'So in order to implement algorithms, you have to have something like observing power.', 'start': 417.743, 'duration': 5.003}, {'end': 424.628, 'text': "Let's start observing.", 'start': 423.107, 'duration': 1.521}, {'end': 429.832, 'text': "What's the first observation? In the entire array, very, very important.", 'start': 424.648, 'duration': 5.184}, {'end': 433.263, 'text': 'In the entire array, we figured out the minimum.', 'start': 430.782, 'duration': 2.481}, {'end': 434.883, 'text': 'Can I say we figured out the minimum?', 'start': 433.583, 'duration': 1.3}], 'summary': 'Algorithm involves repeatedly finding and swapping the minimum value. pseudo code provided for implementation in c++, java, and python.', 'duration': 47.613, 'max_score': 387.27, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24387270.jpg'}, {'end': 976.048, 'src': 'heatmap', 'start': 918.203, 'weight': 0.761, 'content': [{'end': 920.744, 'text': 'And what we can do is we can take the same example that we took.', 'start': 918.203, 'duration': 2.541}, {'end': 927.586, 'text': 'It had six numbers, 13, 46, 24, 52, 20, and 9.', 'start': 921.124, 'duration': 6.462}, {'end': 929.787, 'text': 'We took the same example.', 'start': 927.586, 'duration': 2.201}, {'end': 932.428, 'text': "Over here, let's quickly write the code.", 'start': 929.807, 'duration': 2.621}, {'end': 938.424, 'text': "So whatever pseudocode I did right, that I've converted into code now over here.", 'start': 934.141, 'duration': 4.283}, {'end': 945.729, 'text': 'And if I go across and run this particular task, you will see that this particular array is sorted over here in the output.txt.', 'start': 938.744, 'duration': 6.985}, {'end': 949.132, 'text': 'So you have understood the selection sort algorithm in depth.', 'start': 945.789, 'duration': 3.343}, {'end': 952.454, 'text': "It's time to analyze the time complexity of this particular algorithm.", 'start': 949.612, 'duration': 2.842}, {'end': 952.834, 'text': "Let's see.", 'start': 952.534, 'duration': 0.3}, {'end': 962.401, 'text': 'Can I say, for the first time when the loop gets inside, this particular loop runs for n times exactly.', 'start': 953.575, 'duration': 8.826}, {'end': 967.981, 'text': 'Yes Next time when it gets in, then this actually runs for 1 lesser.', 'start': 962.782, 'duration': 5.199}, {'end': 970.644, 'text': 'It runs for 1 to n minus 1.', 'start': 968.322, 'duration': 2.322}, {'end': 976.048, 'text': 'So can I say it runs for n minus 1? Next time when it gets in, it runs for 1 lesser.', 'start': 970.644, 'duration': 5.404}], 'summary': 'Selection sort algorithm analyzed for time complexity with example array of six numbers.', 'duration': 57.845, 'max_score': 918.203, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24918203.jpg'}, {'end': 976.048, 'src': 'embed', 'start': 945.789, 'weight': 0, 'content': [{'end': 949.132, 'text': 'So you have understood the selection sort algorithm in depth.', 'start': 945.789, 'duration': 3.343}, {'end': 952.454, 'text': "It's time to analyze the time complexity of this particular algorithm.", 'start': 949.612, 'duration': 2.842}, {'end': 952.834, 'text': "Let's see.", 'start': 952.534, 'duration': 0.3}, {'end': 962.401, 'text': 'Can I say, for the first time when the loop gets inside, this particular loop runs for n times exactly.', 'start': 953.575, 'duration': 8.826}, {'end': 967.981, 'text': 'Yes Next time when it gets in, then this actually runs for 1 lesser.', 'start': 962.782, 'duration': 5.199}, {'end': 970.644, 'text': 'It runs for 1 to n minus 1.', 'start': 968.322, 'duration': 2.322}, {'end': 976.048, 'text': 'So can I say it runs for n minus 1? Next time when it gets in, it runs for 1 lesser.', 'start': 970.644, 'duration': 5.404}], 'summary': 'Analyzing time complexity of selection sort algorithm, demonstrating n and n-1 iterations.', 'duration': 30.259, 'max_score': 945.789, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24945789.jpg'}], 'start': 387.27, 'title': 'Sorting algorithms', 'summary': "Discusses the 'get the minimum and swap' algorithm in c++, java, and python, emphasizing observing the minimum in the entire array. it also explains the selection sort algorithm, demonstrating its time complexity of approximately o(n^2) and providing a detailed step-by-step explanation and pseudocode implementation.", 'chapters': [{'end': 434.883, 'start': 387.27, 'title': 'Minimum and swap algorithm', 'summary': "Discusses implementing the 'get the minimum and swap' algorithm in code by writing pseudo code for c++, java, and python, emphasizing the importance of observing the minimum in the entire array.", 'duration': 47.613, 'highlights': ["The chapter emphasizes the 'get the minimum and swap' algorithm for implementation in C++, Java, and Python.", 'The speaker stresses the importance of observing the minimum in the entire array when implementing algorithms.', 'The speaker discusses writing pseudo code for implementing the algorithm in C++, Java, and Python.']}, {'end': 1054.793, 'start': 435.743, 'title': 'Selection sort algorithm', 'summary': 'Explains the selection sort algorithm with an in-depth analysis of the time complexity, demonstrating that the time complexity of the selection sort algorithm is approximately o(n^2). it also provides a detailed step-by-step explanation of the selection sort algorithm and a pseudocode implementation.', 'duration': 619.05, 'highlights': ['The time complexity of the selection sort algorithm is approximately O(n^2), demonstrated through an in-depth analysis of the iterations and a comparison with the summation of the first n natural numbers.', 'The chapter provides a detailed step-by-step explanation of the selection sort algorithm, including the process of finding the minimum value, swapping elements, and the pseudocode for the selection sort function.']}], 'duration': 667.523, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS24387270.jpg', 'highlights': ['The time complexity of the selection sort algorithm is approximately O(n^2), demonstrated through an in-depth analysis of the iterations and a comparison with the summation of the first n natural numbers.', "The chapter emphasizes the 'get the minimum and swap' algorithm for implementation in C++, Java, and Python.", 'The speaker discusses writing pseudo code for implementing the algorithm in C++, Java, and Python.', 'The speaker stresses the importance of observing the minimum in the entire array when implementing algorithms.', 'The chapter provides a detailed step-by-step explanation of the selection sort algorithm, including the process of finding the minimum value, swapping elements, and the pseudocode for the selection sort function.']}, {'end': 1679.658, 'segs': [{'end': 1110.781, 'src': 'embed', 'start': 1055.438, 'weight': 0, 'content': [{'end': 1059.759, 'text': 'So we can say that we have completed selection sort successfully.', 'start': 1055.438, 'duration': 4.321}, {'end': 1061.64, 'text': "Now it's time to understand bubble shot.", 'start': 1059.779, 'duration': 1.861}, {'end': 1063.22, 'text': 'Bubble shot.', 'start': 1062.74, 'duration': 0.48}, {'end': 1067.661, 'text': 'So when you talk about bubble shot, you have to remember, it pushes the maximum to the last.', 'start': 1063.38, 'duration': 4.281}, {'end': 1069.762, 'text': 'Kind of opposite to the selection sort.', 'start': 1068.242, 'duration': 1.52}, {'end': 1073.003, 'text': 'Because selection sort was taking the minimum at the front, if you remember.', 'start': 1069.782, 'duration': 3.221}, {'end': 1075.283, 'text': 'Pushes the maximum to the last.', 'start': 1073.903, 'duration': 1.38}, {'end': 1078.524, 'text': 'How does it do it? By adjacent swapping.', 'start': 1075.924, 'duration': 2.6}, {'end': 1082.425, 'text': 'Adjacent swapping is the key over here.', 'start': 1079.225, 'duration': 3.2}, {'end': 1084.046, 'text': "How does the algorithm work? Let's understand.", 'start': 1082.566, 'duration': 1.48}, {'end': 1086.585, 'text': 'First two elements, compares.', 'start': 1084.824, 'duration': 1.761}, {'end': 1093.15, 'text': 'Are they in the sorted order? 13 and 46, they are because 13 is smaller than 46.', 'start': 1087.346, 'duration': 5.804}, {'end': 1093.93, 'text': 'Do not do anything.', 'start': 1093.15, 'duration': 0.78}, {'end': 1095.451, 'text': 'Go to the next two.', 'start': 1094.711, 'duration': 0.74}, {'end': 1100.054, 'text': 'Are they in the sorted order? 46 before 24.', 'start': 1096.312, 'duration': 3.742}, {'end': 1101.715, 'text': 'No Trap it.', 'start': 1100.054, 'duration': 1.661}, {'end': 1104.437, 'text': 'Okay Trap.', 'start': 1102.796, 'duration': 1.641}, {'end': 1107.76, 'text': '24 24, 46.', 'start': 1104.437, 'duration': 3.323}, {'end': 1110.781, 'text': "Perfect Let's go to the next.", 'start': 1107.76, 'duration': 3.021}], 'summary': 'Successfully completed selection sort, now learning bubble sort for adjacent swapping.', 'duration': 55.343, 'max_score': 1055.438, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241055438.jpg'}, {'end': 1319.42, 'src': 'embed', 'start': 1286.867, 'weight': 4, 'content': [{'end': 1288.208, 'text': 'this is done.', 'start': 1286.867, 'duration': 1.341}, {'end': 1291.029, 'text': 'next step five.', 'start': 1288.208, 'duration': 2.821}, {'end': 1293.13, 'text': 'what is step five?', 'start': 1291.029, 'duration': 2.101}, {'end': 1299.205, 'text': "this let's do a comparison no that 9, 13..", 'start': 1293.13, 'duration': 6.075}, {'end': 1301.487, 'text': 'For this portion, 13 was the maximum.', 'start': 1299.205, 'duration': 2.282}, {'end': 1302.848, 'text': "And it's at the last.", 'start': 1302.007, 'duration': 0.841}, {'end': 1305.91, 'text': 'So, for this portion, 13 was the maximum.', 'start': 1303.448, 'duration': 2.462}, {'end': 1307.171, 'text': "And it's at the last.", 'start': 1306.43, 'duration': 0.741}, {'end': 1311.274, 'text': 'So, thereby, this portion is sorted.', 'start': 1307.751, 'duration': 3.523}, {'end': 1316.798, 'text': 'Post step 5, do you need to do for a single element? You do not.', 'start': 1311.714, 'duration': 5.084}, {'end': 1319, 'text': 'Thereby, the entire array is sorted.', 'start': 1317.439, 'duration': 1.561}, {'end': 1319.42, 'text': 'If you see.', 'start': 1319.06, 'duration': 0.36}], 'summary': 'After step 5, the portion with 13 as maximum is sorted, and the entire array is sorted.', 'duration': 32.553, 'max_score': 1286.867, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241286867.jpg'}, {'end': 1473.079, 'src': 'embed', 'start': 1446.189, 'weight': 3, 'content': [{'end': 1452.443, 'text': "So when you are looping from 0 to n minus 1, it's kind of This is j.", 'start': 1446.189, 'duration': 6.254}, {'end': 1454.865, 'text': "So you're comparing j with j plus 1.", 'start': 1452.443, 'duration': 2.422}, {'end': 1456.727, 'text': "And if they're not, then you're swapping.", 'start': 1454.865, 'duration': 1.862}, {'end': 1458.448, 'text': "So you're kind of comparing.", 'start': 1456.747, 'duration': 1.701}, {'end': 1466.854, 'text': "What are you comparing? If a of j is kind of greater than j plus 1, it's not in the correct order, then you're saying swap.", 'start': 1458.688, 'duration': 8.166}, {'end': 1468.536, 'text': "Then you're saying swap both of them.", 'start': 1467.415, 'duration': 1.121}, {'end': 1471.057, 'text': 'A key thing to notice.', 'start': 1469.776, 'duration': 1.281}, {'end': 1473.079, 'text': 'A very key important thing.', 'start': 1471.478, 'duration': 1.601}], 'summary': 'Loop through and compare elements for swapping if not in correct order.', 'duration': 26.89, 'max_score': 1446.189, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241446189.jpg'}, {'end': 1679.658, 'src': 'embed', 'start': 1625.668, 'weight': 1, 'content': [{'end': 1633.154, 'text': 'first time the algorithm kind of runs for n, then for n minus one, then for n minus two, then for n minus three.', 'start': 1625.668, 'duration': 7.486}, {'end': 1639.62, 'text': "so it's similar to selection sort, where i say it's n plus, n minus one, plus, n minus two, plus.", 'start': 1633.154, 'duration': 6.466}, {'end': 1641.401, 'text': 'so on, the last is two.', 'start': 1639.62, 'duration': 1.781}, {'end': 1645.395, 'text': "It's something if you just add a 1 to it.", 'start': 1642.654, 'duration': 2.741}, {'end': 1647.875, 'text': "It's similar to sum of n natural numbers.", 'start': 1645.835, 'duration': 2.04}, {'end': 1655.276, 'text': 'Again, n into n plus 1 by 2, which is n squared by 2 plus n by 2.', 'start': 1648.455, 'duration': 6.821}, {'end': 1657.737, 'text': 'Smaller constants dissolved.', 'start': 1655.276, 'duration': 2.461}, {'end': 1661.937, 'text': 'So, the complexity is b go of n squared.', 'start': 1658.257, 'duration': 3.68}, {'end': 1664.478, 'text': "Can it be optimized? That's my question.", 'start': 1662.678, 'duration': 1.8}, {'end': 1665.998, 'text': 'Yes, it can be.', 'start': 1665.318, 'duration': 0.68}, {'end': 1667.638, 'text': 'It can be optimized.', 'start': 1666.658, 'duration': 0.98}, {'end': 1670.679, 'text': 'This is the worst complexity.', 'start': 1668.259, 'duration': 2.42}, {'end': 1673.955, 'text': 'This is the worst complexity.', 'start': 1672.534, 'duration': 1.421}, {'end': 1676.496, 'text': 'And you can also call it as the average complexity.', 'start': 1674.295, 'duration': 2.201}, {'end': 1678.317, 'text': 'In most of the cases, this will be the complex.', 'start': 1676.837, 'duration': 1.48}, {'end': 1679.658, 'text': 'Most of the cases.', 'start': 1679.058, 'duration': 0.6}], 'summary': 'Algorithm complexity is o(n^2), can be optimized', 'duration': 53.99, 'max_score': 1625.668, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241625668.jpg'}], 'start': 1055.438, 'title': 'Bubble sort algorithm', 'summary': 'Covers the bubble sort algorithm, which sorts the array through iterative comparison and swapping, with a time complexity of o(n^2) and potential for optimization.', 'chapters': [{'end': 1319.42, 'start': 1055.438, 'title': 'Understanding bubble sort', 'summary': 'Explains the bubble sort algorithm, which sorts the array by pushing the maximum element to the last through adjacent swapping, completing one complete round of adjacent swap checkings and sorting the array portion by portion.', 'duration': 263.982, 'highlights': ['Bubble sort pushes the maximum element to the last through adjacent swapping, completing one complete round of adjacent swap checkings and sorting the array portion by portion.', 'The algorithm compares adjacent elements and swaps them if they are not in the correct order, ensuring the maximum element is pushed to the last of each portion.', 'After each step of the algorithm, the portion of the array after the completed steps is considered sorted, and the algorithm proceeds to work on the remaining unsorted portion.']}, {'end': 1679.658, 'start': 1320.161, 'title': 'Bubble sort algorithm', 'summary': 'Explains the bubble sort algorithm, highlighting the iterative process of comparing and swapping elements to achieve sorting, with a time complexity of o(n^2) and potential for optimization.', 'duration': 359.497, 'highlights': ['The algorithm follows an iterative process where the first loop runs from n-1 to 1, and the internal loop runs from 0 to i-1, resulting in a time complexity of O(n^2).', 'The key step involves comparing two elements and swapping if they are not in the correct order, with the process continuing until the array is sorted.', 'The time complexity of the algorithm is similar to selection sort, with a worst complexity of O(n^2) that can potentially be optimized.', 'Optimization of the algorithm is possible to improve its time complexity from O(n^2) to a more efficient level.']}], 'duration': 624.22, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241055438.jpg', 'highlights': ['Bubble sort pushes the maximum element to the last through adjacent swapping, completing one complete round of adjacent swap checkings and sorting the array portion by portion.', 'The algorithm follows an iterative process with a time complexity of O(n^2), similar to selection sort, and potential for optimization.', 'The algorithm compares adjacent elements and swaps them if they are not in the correct order, ensuring the maximum element is pushed to the last of each portion.', 'The key step involves comparing two elements and swapping if they are not in the correct order, with the process continuing until the array is sorted.', 'After each step of the algorithm, the portion of the array after the completed steps is considered sorted, and the algorithm proceeds to work on the remaining unsorted portion.', 'The time complexity of the algorithm can potentially be optimized to improve its efficiency.']}, {'end': 1920.715, 'segs': [{'end': 1737.259, 'src': 'embed', 'start': 1680.219, 'weight': 1, 'content': [{'end': 1687.463, 'text': 'But imagine if I give you an array, which is something like 2, 3, 5, 15, and 20.', 'start': 1680.219, 'duration': 7.244}, {'end': 1690.705, 'text': "If I give you an array like this, you'll be like, Trevor, this is sorted.", 'start': 1687.463, 'duration': 3.242}, {'end': 1692.126, 'text': 'Yeah, it is sorted.', 'start': 1691.165, 'duration': 0.961}, {'end': 1697.209, 'text': 'So, do you run the loop for n square? Do you go across every time, every time? No.', 'start': 1692.666, 'duration': 4.543}, {'end': 1704.023, 'text': 'So, what is the algorithm? Correct order, no swaps.', 'start': 1697.949, 'duration': 6.074}, {'end': 1706.905, 'text': 'Correct order, no swaps.', 'start': 1705.264, 'duration': 1.641}, {'end': 1709.487, 'text': 'Correct order, no swaps.', 'start': 1707.746, 'duration': 1.741}, {'end': 1711.648, 'text': 'Correct order, no swaps.', 'start': 1710.267, 'duration': 1.381}, {'end': 1720.154, 'text': "Dude, if everything is in the correct order and you're not performing a swap, if everything is in the correct order, what does it signify?", 'start': 1712.309, 'duration': 7.845}, {'end': 1723.116, 'text': 'The array is in the ascending order.', 'start': 1720.574, 'duration': 2.542}, {'end': 1727.819, 'text': 'If everything is in the correct order, the array is in the ascending order.', 'start': 1723.576, 'duration': 4.243}, {'end': 1737.259, 'text': 'So in the first check, you did not find a swap to be done because everything was in the correct order.', 'start': 1728.26, 'duration': 8.999}], 'summary': "Demonstrating a sorted array with no swaps signifies it's in ascending order.", 'duration': 57.04, 'max_score': 1680.219, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241680219.jpg'}, {'end': 1804.341, 'src': 'embed', 'start': 1766.533, 'weight': 2, 'content': [{'end': 1777.282, 'text': 'so can i say, if i say int did swap equal to zero and over here, if i just can say did swap equal to one, which means if any,', 'start': 1766.533, 'duration': 10.749}, {'end': 1782.34, 'text': "If at any moment a swap happened, then it's okay.", 'start': 1778.618, 'duration': 3.722}, {'end': 1790.464, 'text': 'But if didSwap at any time is there was no swap, then I break out.', 'start': 1782.94, 'duration': 7.524}, {'end': 1791.784, 'text': 'I will not go.', 'start': 1791.004, 'duration': 0.78}, {'end': 1798.728, 'text': 'If the array is sorted, it will just check for the first time and it will break post it.', 'start': 1792.164, 'duration': 6.564}, {'end': 1801.229, 'text': 'Right? This also runs.', 'start': 1799.788, 'duration': 1.441}, {'end': 1804.341, 'text': "I'll prove you this one.", 'start': 1802.58, 'duration': 1.761}], 'summary': "Using a variable 'didswap' to break out of loop if no swap occurs", 'duration': 37.808, 'max_score': 1766.533, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241766533.jpg'}, {'end': 1895.266, 'src': 'embed', 'start': 1870.61, 'weight': 0, 'content': [{'end': 1876.874, 'text': 'The time complexity for the best of bubble shot is big O of n.', 'start': 1870.61, 'duration': 6.264}, {'end': 1878.675, 'text': 'This might be asked in an interview.', 'start': 1876.874, 'duration': 1.801}, {'end': 1881.877, 'text': 'You have to critically tell them the use case.', 'start': 1878.975, 'duration': 2.902}, {'end': 1886.54, 'text': 'You have to explain them in the dry run and tell them the worst and the average might be n square.', 'start': 1881.897, 'duration': 4.643}, {'end': 1893.385, 'text': 'But if the array is sorted, I will break out and I will end up getting a linear time complexity because the array is already sorted.', 'start': 1886.961, 'duration': 6.424}, {'end': 1895.266, 'text': 'So the bubble shot is done.', 'start': 1893.965, 'duration': 1.301}], 'summary': 'Bubble sort time complexity is o(n), improves if array is sorted.', 'duration': 24.656, 'max_score': 1870.61, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241870610.jpg'}], 'start': 1680.219, 'title': 'Sorting algorithms and optimization', 'summary': 'Covers the algorithm for sorting arrays, using the example of a sorted array, emphasizing correct order and no swaps. it also explains the optimization of the bubble sort algorithm, showcasing its best time complexity of o(n) and its use case for a sorted array.', 'chapters': [{'end': 1737.259, 'start': 1680.219, 'title': 'Algorithm for sorting arrays', 'summary': 'Explains the algorithm for sorting arrays using the example of a sorted array 2, 3, 5, 15, and 20, emphasizing the concept of correct order and no swaps to signify ascending order.', 'duration': 57.04, 'highlights': ['The concept of correct order and no swaps signifies the array is in ascending order.', 'The example of a sorted array 2, 3, 5, 15, and 20 illustrates the concept of correct order and no swaps.', 'The algorithm for sorting arrays emphasizes the significance of correct order and no swaps.']}, {'end': 1920.715, 'start': 1737.7, 'title': 'Bubble sort optimization', 'summary': 'Explains the optimization of the bubble sort algorithm, demonstrating how the best time complexity is o(n) and highlighting the use case for a sorted array.', 'duration': 183.015, 'highlights': ['The best time complexity for the bubble sort algorithm is O(n), and it is crucial to explain the use case for a sorted array in interviews.', "Demonstration of the algorithm's behavior with sorted and unsorted arrays, showing that for a sorted array, the algorithm breaks early, resulting in linear time complexity.", "Explanation of the optimization technique using 'did swap' flag to improve the performance of the bubble sort algorithm."]}], 'duration': 240.496, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241680219.jpg', 'highlights': ['The best time complexity for the bubble sort algorithm is O(n), crucial for interviews.', "Demonstration of the algorithm's behavior with sorted and unsorted arrays, showcasing linear time complexity for a sorted array.", "Explanation of the optimization technique using 'did swap' flag to improve the performance of the bubble sort algorithm.", 'The concept of correct order and no swaps signifies the array is in ascending order.', 'The example of a sorted array 2, 3, 5, 15, and 20 illustrates the concept of correct order and no swaps.', 'The algorithm for sorting arrays emphasizes the significance of correct order and no swaps.']}, {'end': 2214.576, 'segs': [{'end': 1950.837, 'src': 'embed', 'start': 1921.596, 'weight': 0, 'content': [{'end': 1929.021, 'text': 'And you will say that if this much is the array, the element 14 in a size 1 array is at the correct.', 'start': 1921.596, 'duration': 7.425}, {'end': 1938.088, 'text': "If I look at this much and I ask you, is 9 at the correct position? You'll be like, no.", 'start': 1931.063, 'duration': 7.025}, {'end': 1940.97, 'text': '9 apparently should have been here and 14 should have been here.', 'start': 1938.108, 'duration': 2.862}, {'end': 1942.371, 'text': 'So this is what you do.', 'start': 1941.57, 'duration': 0.801}, {'end': 1949.095, 'text': 'You go to the next element and you ask on the left side where 9 should have been.', 'start': 1943.792, 'duration': 5.303}, {'end': 1950.837, 'text': 'And that is where you take it.', 'start': 1949.896, 'duration': 0.941}], 'summary': 'Correct array position: 14 in size 1 array, 9 misplaced', 'duration': 29.241, 'max_score': 1921.596, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241921596.jpg'}, {'end': 2041.669, 'src': 'embed', 'start': 2008.407, 'weight': 2, 'content': [{'end': 2009.307, 'text': 'Till it can be swapped.', 'start': 2008.407, 'duration': 0.9}, {'end': 2011.008, 'text': 'So if you do like this.', 'start': 2009.928, 'duration': 1.08}, {'end': 2012.389, 'text': '12 goes here.', 'start': 2011.028, 'duration': 1.361}, {'end': 2015.19, 'text': "It's like 12 and 15.", 'start': 2012.729, 'duration': 2.461}, {'end': 2017.15, 'text': 'Then 12, 14.', 'start': 2015.19, 'duration': 1.96}, {'end': 2018.792, 'text': 'So 12 goes here and 14 comes.', 'start': 2017.151, 'duration': 1.641}, {'end': 2020.893, 'text': 'Go to the left till it can be.', 'start': 2019.492, 'duration': 1.401}, {'end': 2022.754, 'text': 'Can 12 be swapped with 9? No.', 'start': 2021.273, 'duration': 1.481}, {'end': 2024.895, 'text': 'Because that will distort the order.', 'start': 2023.054, 'duration': 1.841}, {'end': 2026.116, 'text': 'It just goes till here.', 'start': 2025.175, 'duration': 0.941}, {'end': 2033.666, 'text': "Simple So what will happen? It'll be like 12, 14, 15.", 'start': 2026.656, 'duration': 7.01}, {'end': 2036.027, 'text': 'Perfect Next is 6.', 'start': 2033.666, 'duration': 2.361}, {'end': 2041.669, 'text': 'If you look at 6, where ideally should be 6 in this array? It should be here.', 'start': 2036.027, 'duration': 5.642}], 'summary': 'Discussion on swapping numbers in an array to maintain order and positions.', 'duration': 33.262, 'max_score': 2008.407, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242008407.jpg'}, {'end': 2127.891, 'src': 'embed', 'start': 2099.414, 'weight': 4, 'content': [{'end': 2101.415, 'text': "Perfect It's like 6, 9, 12, 14, 15.", 'start': 2099.414, 'duration': 2.001}, {'end': 2109.858, 'text': "So if I have to write it by raising, it's like 6, 9, 12, 14, 15.", 'start': 2101.415, 'duration': 8.443}, {'end': 2114.583, 'text': 'Perfect I just went down to the left till it could have been swap, swap, swap.', 'start': 2109.86, 'duration': 4.723}, {'end': 2118.325, 'text': 'Right Next, 8.', 'start': 2115.263, 'duration': 3.062}, {'end': 2125.149, 'text': 'In this particular array, where does 8 will go? Where will 8 go? In this particular array, where will 8 go? Ask yourself.', 'start': 2118.325, 'duration': 6.824}, {'end': 2127.891, 'text': 'The answer to that is 8 will go here.', 'start': 2125.93, 'duration': 1.961}], 'summary': 'Identifying the position of 8 in the array, 8 will be placed at this position.', 'duration': 28.477, 'max_score': 2099.414, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242099414.jpg'}, {'end': 2193.363, 'src': 'embed', 'start': 2155.73, 'weight': 3, 'content': [{'end': 2171.673, 'text': 'How do you know it? Because when you compare 8 with 6, was not compared and dusted 6 8 9 12 14 15 6 8 9 12 14 15 remember this 6 8 9 12 14 15.', 'start': 2155.73, 'duration': 15.943}, {'end': 2183.149, 'text': 'next 13 is the next guy that you are comparing can i say 13 ideally over here should have been here so do it again 13 goes here.', 'start': 2171.673, 'duration': 11.476}, {'end': 2183.63, 'text': '15 comes here.', 'start': 2183.209, 'duration': 0.421}, {'end': 2185.773, 'text': '13 goes here.', 'start': 2183.65, 'duration': 2.123}, {'end': 2186.173, 'text': '14 comes here.', 'start': 2185.793, 'duration': 0.38}, {'end': 2188.316, 'text': 'Can I do a 13, 12? No.', 'start': 2186.413, 'duration': 1.903}, {'end': 2193.363, 'text': 'Stop Can I say post the last? The array is sorted.', 'start': 2189.197, 'duration': 4.166}], 'summary': 'Comparing and sorting numbers: 6, 8, 9, 12, 13, 14, 15', 'duration': 37.633, 'max_score': 2155.73, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242155730.jpg'}], 'start': 1921.596, 'title': 'Verifying array positions and sorting with swapping', 'summary': 'Covers verifying element positions in arrays, with examples involving the evaluation of 9, 12, 14, and 15 in arrays of varying sizes, and sorting arrays by swapping elements like 14, 15, and 12 until the array is sorted, resulting in 6, 8, 9, 12, 14, 15.', 'chapters': [{'end': 1978.701, 'start': 1921.596, 'title': 'Array position verification', 'summary': 'Discusses the process of verifying the correct position of elements in an array, exemplified by evaluating the positions of 9, 12, 14, and 15 in arrays of varying sizes.', 'duration': 57.105, 'highlights': ['You evaluate the correct position of elements in an array by comparing their positions with their expected locations, such as checking if 9, 12, 14, and 15 are at the correct positions for arrays of different sizes.', 'The process involves iterating through the elements and determining if each element is at its expected position, as seen with the evaluation of 9, 12, 14, and 15 in arrays of varying sizes.']}, {'end': 2214.576, 'start': 1978.721, 'title': 'Sorting array with swapping', 'summary': 'Demonstrates the process of sorting an array by swapping elements, such as 14, 15, and 12, until the array is sorted, resulting in the array being sorted as 6, 8, 9, 12, 14, 15.', 'duration': 235.855, 'highlights': ['The process of sorting an array by swapping elements, such as 14, 15, and 12, until the array is sorted.', 'The resulting array being sorted as 6, 8, 9, 12, 14, 15.', 'Explanation of the sequential swapping process for each element in the array.']}], 'duration': 292.98, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS241921596.jpg', 'highlights': ['You evaluate the correct position of elements in an array by comparing their positions with their expected locations, such as checking if 9, 12, 14, and 15 are at the correct positions for arrays of different sizes.', 'The process involves iterating through the elements and determining if each element is at its expected position, as seen with the evaluation of 9, 12, 14, and 15 in arrays of varying sizes.', 'The process of sorting an array by swapping elements, such as 14, 15, and 12, until the array is sorted.', 'The resulting array being sorted as 6, 8, 9, 12, 14, 15.', 'Explanation of the sequential swapping process for each element in the array.']}, {'end': 2615.889, 'segs': [{'end': 2250.956, 'src': 'embed', 'start': 2215.636, 'weight': 4, 'content': [{'end': 2216.937, 'text': "That's something for sure.", 'start': 2215.636, 'duration': 1.301}, {'end': 2222.058, 'text': "I'm running from 0 to n minus 1.", 'start': 2217.477, 'duration': 4.581}, {'end': 2223.038, 'text': 'And what am I doing??', 'start': 2222.058, 'duration': 0.98}, {'end': 2224.679, 'text': 'What am I doing?', 'start': 2224.119, 'duration': 0.56}, {'end': 2229.801, 'text': "every guy i'm looking at the left are you greater?", 'start': 2225.658, 'duration': 4.143}, {'end': 2230.482, 'text': 'are you greater?', 'start': 2229.801, 'duration': 0.681}, {'end': 2232.303, 'text': 'swap and till.', 'start': 2230.482, 'duration': 1.821}, {'end': 2234.945, 'text': 'i can do it like for 13.', 'start': 2232.303, 'duration': 2.642}, {'end': 2238.708, 'text': 'i could do till here, till it is possible on the left.', 'start': 2234.945, 'duration': 3.763}, {'end': 2250.956, 'text': "so i'll be like okay, maybe j is i and i can keep, while j greater than zero and i can say and and okay, hey, left, j minus one,", 'start': 2238.708, 'duration': 12.248}], 'summary': 'Algorithm discussion on iterating and swapping elements.', 'duration': 35.32, 'max_score': 2215.636, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242215636.jpg'}, {'end': 2368.586, 'src': 'embed', 'start': 2332.505, 'weight': 1, 'content': [{'end': 2336.447, 'text': 'So now time to write insertion sort.', 'start': 2332.505, 'duration': 3.942}, {'end': 2343.469, 'text': 'So void insertion sort int array and int n.', 'start': 2336.487, 'duration': 6.982}, {'end': 2347.911, 'text': 'As usual, we can just do this as insertion sort.', 'start': 2343.469, 'duration': 4.442}, {'end': 2349.932, 'text': "And I'll quickly write the pseudocode.", 'start': 2348.651, 'duration': 1.281}, {'end': 2354.674, 'text': 'Until here, you know the pseudocode.', 'start': 2353.413, 'duration': 1.261}, {'end': 2360.416, 'text': 'Why j greater than zero? Why not greater than equal to? Imagine if j goes equal to zero.', 'start': 2354.954, 'duration': 5.462}, {'end': 2362.438, 'text': 'j minus one.', 'start': 2361.417, 'duration': 1.021}, {'end': 2365.983, 'text': 'like when j is zero, j minus one will be minus one.', 'start': 2362.438, 'duration': 3.545}, {'end': 2368.586, 'text': "runtime. that's one all right.", 'start': 2365.983, 'duration': 2.603}], 'summary': 'Writing insertion sort pseudocode for int array and n, discussing runtime.', 'duration': 36.081, 'max_score': 2332.505, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242332505.jpg'}, {'end': 2432.144, 'src': 'embed', 'start': 2395.079, 'weight': 3, 'content': [{'end': 2401.903, 'text': 'simple. if we analyze the time complexity, what will be the time complexity?', 'start': 2395.079, 'duration': 6.824}, {'end': 2411.123, 'text': 'imagine for a reversed array like something like five, four, three, two, one.', 'start': 2401.903, 'duration': 9.22}, {'end': 2413.806, 'text': "what's happening for the first time?", 'start': 2411.123, 'duration': 2.683}, {'end': 2416.229, 'text': 'five, no swaps.', 'start': 2413.806, 'duration': 2.423}, {'end': 2421.375, 'text': "next time it comes to four and does a swap, it's like four.", 'start': 2416.229, 'duration': 5.146}, {'end': 2425.362, 'text': "Next time it comes to 3, it doesn't complete.", 'start': 2422.901, 'duration': 2.461}, {'end': 2428.363, 'text': 'Like 3 goes here, then 3 goes here.', 'start': 2425.402, 'duration': 2.961}, {'end': 2432.144, 'text': "So it's like 3, 4, 5, 2, 1.", 'start': 2428.703, 'duration': 3.441}], 'summary': 'Analyzing time complexity of sorting a reversed array.', 'duration': 37.065, 'max_score': 2395.079, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242395079.jpg'}, {'end': 2516.594, 'src': 'embed', 'start': 2486.765, 'weight': 0, 'content': [{'end': 2492.944, 'text': 'So, I can say The kind of worst case is n square.', 'start': 2486.765, 'duration': 6.179}, {'end': 2496.605, 'text': 'The average case is also n square.', 'start': 2493.704, 'duration': 2.901}, {'end': 2501.847, 'text': 'And what about the best case? Imagine I give you something like 1, 2, 3, 4, 5.', 'start': 2497.026, 'duration': 4.821}, {'end': 2503.648, 'text': '1, 2, 3, 4, 5.', 'start': 2501.848, 'duration': 1.8}, {'end': 2505.989, 'text': 'And I go back to the code.', 'start': 2503.648, 'duration': 2.341}, {'end': 2507.97, 'text': 'And I go back to the code.', 'start': 2506.99, 'duration': 0.98}, {'end': 2511.952, 'text': 'So imagine I give you a completely sorted array.', 'start': 2509.331, 'duration': 2.621}, {'end': 2513.473, 'text': 'And I go back to the code.', 'start': 2512.572, 'duration': 0.901}, {'end': 2516.594, 'text': "And let's see how many times this loop runs.", 'start': 2513.533, 'duration': 3.061}], 'summary': "In worst and average cases, the complexity is n square; in the best case, it's linear.", 'duration': 29.829, 'max_score': 2486.765, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242486765.jpg'}, {'end': 2569.729, 'src': 'embed', 'start': 2536.635, 'weight': 2, 'content': [{'end': 2540.741, 'text': 'So, apparently, only this loop runs for check.', 'start': 2536.635, 'duration': 4.106}, {'end': 2542.704, 'text': "It's a big go of n.", 'start': 2541.302, 'duration': 1.402}, {'end': 2552.775, 'text': 'The best case for this is nothing but big go of n complexity because There is no swaps that happen.', 'start': 2542.704, 'duration': 10.071}, {'end': 2555.097, 'text': 'Everyone is at its correct order.', 'start': 2553.255, 'duration': 1.842}, {'end': 2556.278, 'text': 'Just go to everyone.', 'start': 2555.437, 'duration': 0.841}, {'end': 2562.043, 'text': 'That is what the time is taken for in case of insertion sort.', 'start': 2556.558, 'duration': 5.485}, {'end': 2565.846, 'text': 'So with this, I can tick mark insertion sort and it is completed.', 'start': 2562.123, 'duration': 3.723}, {'end': 2569.729, 'text': 'The time is 5.29.', 'start': 2565.866, 'duration': 3.863}], 'summary': 'Insertion sort completed with a time of 5.29.', 'duration': 33.094, 'max_score': 2536.635, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242536635.jpg'}], 'start': 2215.636, 'title': 'Sorting algorithms', 'summary': "Explains a sorting algorithm using a step-by-step process of comparing and swapping numbers within a range from 0 to n minus 1, and discusses the implementation of the insertion sort algorithm in pseudocode, analysis of its time complexity in best, worst, and average cases, and concludes with the algorithm's completion and time taken for the explanation.", 'chapters': [{'end': 2278.33, 'start': 2215.636, 'title': 'Sorting algorithm explanation', 'summary': 'Explains a sorting algorithm using a step-by-step process of comparing and swapping numbers within a range from 0 to n minus 1.', 'duration': 62.694, 'highlights': ['Explaining the step-by-step process of comparing and swapping numbers', 'Defining the range of comparison from 0 to n minus 1']}, {'end': 2615.889, 'start': 2278.35, 'title': 'Insertion sort algorithm', 'summary': "Discusses the implementation of the insertion sort algorithm in pseudocode, analysis of its time complexity in best, worst, and average cases, and concludes with the algorithm's completion and time taken for the explanation.", 'duration': 337.539, 'highlights': ['The time complexity of insertion sort is analyzed, with the worst and average cases both being n square, and the best case being linear time complexity (big O of n).', 'The implementation of the insertion sort algorithm in pseudocode is demonstrated, including the swapping process and the movement of the index.', 'The completion of the insertion sort algorithm is indicated, along with the time taken for the explanation.']}], 'duration': 400.253, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/HGk_ypEuS24/pics/HGk_ypEuS242215636.jpg', 'highlights': ['The time complexity of insertion sort is analyzed, with the worst and average cases both being n square', 'The implementation of the insertion sort algorithm in pseudocode is demonstrated, including the swapping process and the movement of the index', 'The best case time complexity of insertion sort is linear (big O of n)', 'Explaining the step-by-step process of comparing and swapping numbers', 'Defining the range of comparison from 0 to n minus 1', 'The completion of the insertion sort algorithm is indicated, along with the time taken for the explanation']}], 'highlights': ["The Strivers A2Z DSA course is India's most comprehensive course on DS Algo with 456 modules, making it the most in-depth course on DS Algo in India.", 'LearnBay offers data science and full stack development programs with 100% live online classes, industry-based capstone projects certified by IBM, three years of subscription, and 100 job assistance with hikes up to 250 by partnering with more than 250 companies like UI, Intel, SAP, and others.', 'The time complexity of the selection sort algorithm is approximately O(n^2), demonstrated through an in-depth analysis of the iterations and a comparison with the summation of the first n natural numbers.', 'The best time complexity for the bubble sort algorithm is O(n), crucial for interviews.', 'You evaluate the correct position of elements in an array by comparing their positions with their expected locations, such as checking if 9, 12, 14, and 15 are at the correct positions for arrays of different sizes.', 'The time complexity of insertion sort is analyzed, with the worst and average cases both being n square']}