Quick Sort Algorithm | Lecture-42 | Java and DSA Foundation course

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 42

  • @CollegeWallahbyPW
    @CollegeWallahbyPW  Рік тому +1

    PW Skills is announcing the launch of the following programs,
    Binary Batch:- Java-with-DSA-&-System-Design (Java with DSA & System Design)
    pwskills.com/course/Java-with-DSA-and-system-design (Hindi)
    pwskills.com/course/Java-with-DSA-and-System-Design (English)
    Sigma Batch:- Full-Stack-Web-Development (MERN Stack)
    pwskills.com/course/Full-Stack-web-development (Hindi)
    pwskills.com/course/Full-Stack-Web-Development (English)
    Impact Batch:- Data-Science-Masters (Full Stack Data Science)
    pwskills.com/course/Data-Science-masters (Hindi)
    pwskills.com/course/Data-Science-Masters (English)

    • @sintu8259
      @sintu8259 Рік тому

      Data analytics course kab start hoga

    • @mukeshmittal4989
      @mukeshmittal4989 Рік тому

      One video in the Java playlist is hidden. Kindly public the video so that we can learn more and can take advantage of it.

  • @Luffy_2804
    @Luffy_2804 Рік тому +6

    for those who did not get how the time complexity of nested loop is O(n)
    we calculate the time complexity of nested loop :- by finding how many time the inner loops are running for nth value of outermost loop
    here the outer loop will almost run for n-1 time maximum as the pivot is fixed so array length -1
    now we will count the number of iterations of inner loop
    since first while loop checks the condition if arr[i]

  • @Luffy_2804
    @Luffy_2804 Рік тому +3

    1:17:10
    static int partition2(int[] arr, int start, int end) {
    Random random = new Random();
    int randomIndex = random.nextInt(end - start + 1) + start;

    // Swap the random pivot element with the first element to improve worst case
    swapElements(arr, start, randomIndex);
    int pivot = arr[start];

    // now the pivot is on start index so check the elements after pivot are they smaller or larger or equal to pivot
    int i = start + 1;
    int j = end;

    while (i

  • @viveksahane1314
    @viveksahane1314 10 місяців тому +8

    time compexity dimaag ke upr se ja rha he 🤕🤕

  • @johnsonsvaselly5008
    @johnsonsvaselly5008 Рік тому +2

    Thank for this beautiful lecture maanvi maam

  • @yashmoriya6891
    @yashmoriya6891 Рік тому +2

    Thank You Mam ❤❤❤

  • @mdnadeem3148
    @mdnadeem3148 Рік тому

    Thank you Mam,
    You are amazing ❤❤

  • @aniketsaini5431
    @aniketsaini5431 7 місяців тому

    great explanation mam

  • @Sportscentre17
    @Sportscentre17 Рік тому +4

    Mam, mein leetcode per question try kar raha hu ,basically Maine array se chalu kiya,lekin logic or code dono nahi bana pa raha hu , consistent hu lekin jab logic nahi banta to motivation down ho jata hai mam

    • @Luffy_2804
      @Luffy_2804 Рік тому +1

      abi bi h kya consistent

    • @uchako7219
      @uchako7219 Рік тому

      ​@@Luffy_2804 hey listen I have seen you consistent would you like to clear my doubts ?

    • @hiibuddy
      @hiibuddy 11 місяців тому

      ​@@uchako7219please tell your doubt

  • @amansinghthakur7116
    @amansinghthakur7116 Рік тому

    mam very outstanding explanation

  • @TheSakshamSchool
    @TheSakshamSchool Рік тому +1

    When will be the lectures, lesson plans, assignment and solutions be uploaded?

  • @YuvrajSingh-td8rv
    @YuvrajSingh-td8rv Рік тому +1

    Thanks ma'am

  • @janmejaysahu9011
    @janmejaysahu9011 Рік тому +1

    Thank you mam

  • @thisismoyukhsworld2022
    @thisismoyukhsworld2022 Рік тому

    For Sorting in Descending Order, what to do????

  • @RAJpal-dt7vb
    @RAJpal-dt7vb 6 місяців тому

    Notes are not available please provide through a link and the provided link is invalid. Fix it

  • @rabindranathbrahmachari9503
    @rabindranathbrahmachari9503 Рік тому +1

    Mam but java to pass by value leta hain to alag stack frame main elements ko manipulate karke ap sorted array kaise la rahe ho ?

    • @svedits7567
      @svedits7567 Рік тому

      bro aap first year ho?

    • @nucle0981
      @nucle0981 Рік тому

      Bhai tu chod de DSA ,jaake pehle basics clear kr fir idhar aana,

    • @nucle0981
      @nucle0981 Рік тому

      But array is pass by reference

    • @sanchitsingh695
      @sanchitsingh695 Рік тому

      @@nucle0981 308
      Everything in Java is passed by value. In case of an array which is nothing but an Object, the array reference is passed by value just like an object reference is passed by value.

    • @Luffy_2804
      @Luffy_2804 Рік тому

      reference pass hota hai jo orignal array ko point karta h or jab recursion call hoti h to new array banta hai par vo bi same hi object ko point kar rha hota isliye jab method call hoti h to array update ho jata h

  • @sintu8259
    @sintu8259 Рік тому

    Data analytics course kab tak start hoga

  • @sandeepgupta7589
    @sandeepgupta7589 25 днів тому

    public class Quicksort {

    static void printArray(int arr[]){
    for(int val : arr){
    System.out.print(val+" ");
    }
    System.out.println();
    }
    static void swap(int arr[],int x,int y){
    int temp= arr[x];
    arr[x]=arr[y];
    arr[y]=temp;
    }
    static int partition(int arr[],int start,int end){
    int pivot =arr[start];
    int cnt = 0;
    for(int i= start+1;i=end){
    return;
    }
    int pi = partition(arr, start, end);
    quickSort(arr, start, pi-1);
    quickSort(arr, pi+1, end);
    }
    public static void main(String[] args) {


    int arr[] = {2,4,33,8,6,43,5};
    System.out.println("array before sorting");
    printArray(arr);
    int n=arr.length;
    quickSort(arr,0,n-1);
    System.out.println("array after sorting");
    printArray(arr);
    }
    }

  • @girishpatil7148
    @girishpatil7148 Рік тому +1

    Mam, crystal clear explanation

  • @aayush2.0
    @aayush2.0 Рік тому +1

    Mam react sikhna h

  • @vipulnaik8617
    @vipulnaik8617 Рік тому +1

    Can anyone find an error I am not getting expected result
    static int partition(int[] arr,int start,int end) {
    int pivot = arr[start];
    int cnt = 0;
    for(int i = start + 1;i pivotIdx) {
    swap(arr,i,j);
    i++;
    j--;
    }
    }
    return pivotIdx;
    }
    static void quickSort(int[] arr,int start,int end) {
    if(start >= end) return;
    int pi = partition(arr,start,end);
    quickSort(arr,start,pi - 1);
    quickSort(arr,pi + 1,end);
    }

    • @abhayyraz
      @abhayyraz Рік тому

      which error you are getting

    • @manasa7070
      @manasa7070 Рік тому +1

      if we take 5 4 3 2 1 it is giving 1 4 3 2 5

  • @abhishekmbit7074
    @abhishekmbit7074 Рік тому

    Really

  • @rhitj5541
    @rhitj5541 6 місяців тому

    Time and space complexity smjh hi nahi aarha 😢

  • @Luffy_2804
    @Luffy_2804 Рік тому +1

    day 9 of being consitent :(

  • @ravikumar_2600
    @ravikumar_2600 Рік тому +2

    👍

  • @harshchouksey7740
    @harshchouksey7740 Рік тому

    👍👍👍

  • @madhav2993
    @madhav2993 Рік тому

    lectures are too long😵😵😵😵

  • @sunilbairwa-7977
    @sunilbairwa-7977 Рік тому

    kuch samaz nahi aaya

  • @vaishnutejass2724
    @vaishnutejass2724 Рік тому +1

    Thank you Mam