COURSES
MBAData Science & AnalyticsDoctorate Software & Tech AI | ML MarketingManagement
Professional Certificate Programme in HR Management and AnalyticsPost Graduate Certificate in Product ManagementExecutive Post Graduate Program in Healthcare ManagementExecutive PG Programme in Human Resource ManagementMBA in International Finance (integrated with ACCA, UK)Global Master Certificate in Integrated Supply Chain ManagementAdvanced General Management ProgramManagement EssentialsLeadership and Management in New Age BusinessProduct Management Online Certificate ProgramStrategic Human Resources Leadership Cornell Certificate ProgramHuman Resources Management Certificate Program for Indian ExecutivesGlobal Professional Certificate in Effective Leadership and ManagementCSM® Certification TrainingCSPO® Certification TrainingLeading SAFe® 5.1 Training (SAFe® Agilist Certification)SAFe® 5.1 POPM CertificationSAFe® 5.1 Scrum Master Certification (SSM)Implementing SAFe® 5.1 with SPC CertificationSAFe® 5 Release Train Engineer (RTE) CertificationPMP® Certification TrainingPRINCE2® Foundation and Practitioner Certification
Law
Job Linked
Bootcamps
Study Abroad
MS in Data AnalyticsMS in Project ManagementMS in Information TechnologyMasters Degree in Data Analytics and VisualizationMasters Degree in Artificial IntelligenceMBS in Entrepreneurship and MarketingMSc in Data AnalyticsMS in Data AnalyticsMS in Computer ScienceMaster of Science in Business AnalyticsMaster of Business Administration MS in Data ScienceMS in Information TechnologyMaster of Business AdministrationMS in Applied Data ScienceMaster of Business Administration | STEMMS in Data AnalyticsM.Sc. Data Science (60 ECTS)Master of Business AdministrationMS in Information Technology and Administrative Management MS in Computer Science Master of Business Administration Master of Business Administration-90 ECTSMSc International Business ManagementMS Data Science Master of Business Administration MSc Business Intelligence and Data ScienceMS Data Analytics MS in Management Information SystemsMSc International Business and ManagementMS Engineering ManagementMS in Machine Learning EngineeringMS in Engineering ManagementMSc Data EngineeringMSc Artificial Intelligence EngineeringMPS in InformaticsMPS in Applied Machine IntelligenceMS in Project ManagementMPS in AnalyticsMS in Project ManagementMS in Organizational LeadershipMPS in Analytics - NEU CanadaMBA with specializationMPS in Informatics - NEU Canada Master in Business AdministrationMS in Digital Marketing and MediaMSc Sustainable Tourism and Event ManagementMSc in Circular Economy and Sustainable InnovationMSc in Impact Finance and Fintech ManagementMS Computer ScienceMS in Applied StatisticsMaster in Computer Information SystemsMBA in Technology, Innovation and EntrepreneurshipMSc Data Science with Work PlacementMSc Global Business Management with Work Placement MBA with Work PlacementMS in Robotics and Autonomous SystemsMS in Civil EngineeringMS in Internet of ThingsMSc International Logistics and Supply Chain ManagementMBA- Business InformaticsMSc International ManagementMBA in Strategic Data Driven ManagementMSc Digital MarketingMBA Business and MarketingMaster of Business AdministrationMSc in Sustainable Global Supply Chain ManagementMSc Digital Business Analytics MSc in International HospitalityMSc Luxury and Innovation ManagementMaster of Business Administration-International Business ManagementMS in Computer EngineeringMS in Industrial and Systems EngineeringMSc International Business ManagementMaster in ManagementMSc MarketingMSc Business ManagementMSc Global Supply Chain ManagementMS in Information Systems and Technology with Business Intelligence and Analytics ConcentrationMSc Corporate FinanceMSc Data Analytics for BusinessMaster of Business AdministrationMaster of Business AdministrationMaster of Business AdministrationMSc in International FinanceMSc in International Management and Global LeadershipMaster of Business AdministrationBachelor of BusinessMaster of Business Administration 60 ECTSMaster of Business Administration 90 ECTSMaster of Business Administration 90 ECTSBachelor of Business AnalyticsBachelor of Information TechnologyMaster of Business AdministrationMBA Business AnalyticsMSc in Marketing Analytics and Data IntelligenceMS Biotechnology Management and EntrepreneurshipMSc in Luxury and Fashion ManagementMaster of Business Administration (90 ECTS)Bachelor of Business Administration (180 ECTS)B.Sc. Computer Science (180 ECTS) MSc in International Corporate Finance MSc in Sustainable Luxury and Creative IndustriesMSc Digital MarketingMSc Global Supply Chain Management (PGMP)MSc Marketing (PGMP)MSc Corporate Finance (PGMP)MSc Data Analytics for Business (PGMP)MS Business AnalyticsMaster of Business AdministrationMS Quantitative FinanceMS Fintech Management
For College Students

Quick Sort Through a Cards Game

$$/$$

Now that you have formed an understanding of how quicksort works, let’s try to sort the same six cards we have been using until now using Quicksort.

$$/$$

Video Transcript

 

So this time we have another random list which we need to sort in ascending order but using Quicksort. So for Quicksort we'll take a random number and call it the pivot. In our example, let's take six as the pivot. Now we simply compare six with each number in the list. And if that number is smaller than six, we place it to the left of six. We compare five with the six. Since five is smaller, we place it to the left of six. Next we compare eight. Since eight is bigger than six, we place it to the right. Three is again smaller than six, so we place it to the left. Similarly, four is smaller, so we place it to the left. And finally seven is bigger than six. It gets placed to the right. Now we know that six is on the correct position in the entire list. Now we'll focus on all the numbers just to the left of six and ignore these for now, we'll come back to them later. Now again we'll take a random pivot. Let's take five as the pivot this time. So we have five. Now we compare five with each number in the list. We compare five with the three. Since three is smaller than five, we place it to the left of five. We compare four with the five, and again it's lesser. So we place it to the left. So we also know that five is in the correct position. Now we'll focus on the numbers to the left of five. We'll again take a random pivot. Let's take four as the pivot. Since three is smaller than four, we'll place it to the left. And now we have these numbers sorted. Now we know six was already on the correct position. So we'll focus on the numbers to the right of six, the eight and the seven. We'll again take a random pivot. Let's take seven for instance and compare all numbers to seven. Since we have eight, we compare seven with eight and understand that eight is bigger. So we will place eight to the right of seven. And since we only have two numbers, we now know that these are also sorted. We place them back and we have a sorted array using Quicksort.

 

Video Recap

 

  • "How to Sort a Random List in Ascending Order Using Quicksort" 

  • Choose a random number from the list and call it the pivot.

  • Compare each number in the list with the pivot.

  • If the number is smaller than the pivot, place it to the left of the pivot. If it's bigger, place it to the right.

  • The pivot is now in the correct position in the entire list.

  • Ignore the numbers to the right of the pivot and focus on the numbers to the left.

  • Choose a new pivot from the remaining numbers and repeat the process until all the numbers are sorted.

  • Place the sorted numbers back into the original list.

 

Let us now try to understand the practical implications of an algorithm being of the O(n), O(), or O(n*logn). Aishwarya will demonstrate through a simple mathematical example as to how time complexities actually affect the time taken by an algorithm. We will try to see that it makes a huge difference if two different algorithms are run having O(n) or in O(nlogn) time complexity.

$$/$$

Great! We are finally done with understanding thoroughly how Quicksort works, seen its Java implementation and also discussed its time complexity. It is now time for us to compare the various sorting algorithms we have learnt so far. Let us know more about it in the next segment.