Bubble Sort - Time Complexity

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ส.ค. 2024
  • Video 24 of a series explaining the basic concepts of Data Structures and Algorithms.
    This video explains the time complexity analysis for bubble sort.
    This video is meant for educational purposes only.

ความคิดเห็น • 56

  • @shinebaka5696
    @shinebaka5696 4 ปีที่แล้ว +2

    I just came back from google chrome i saw the same hands and same piece of paper in that website also. Your voice is clear and explanation is also good. Thank you lady.

  • @ValentinRad
    @ValentinRad 2 ปีที่แล้ว +3

    Thanks for the video, I was looking for a recap on how to calculate time complexity and this helped a lot 👍

  • @nw9409
    @nw9409 5 หลายเดือนก่อน

    Thank you very much , this is the most clear explanation I watched. Thanks

  • @Varun-iq7uw
    @Varun-iq7uw 7 หลายเดือนก่อน

    Your video really helped a lot. Thank You

  • @omnione2719
    @omnione2719 2 ปีที่แล้ว

    Great video, short and brief to the point!

  • @Daniel-wt9bh
    @Daniel-wt9bh 4 ปีที่แล้ว +8

    Why arr[j] = arr[j+1] is 2x, when there are 2 indexing operations and 1 assignment. I think it should be 3x only in that case. Any explanations please.

    • @birenmer4218
      @birenmer4218 2 ปีที่แล้ว

      I do have the same que N i guess there will be 3 pos as 2 indexing and one assignment

  • @ownyounext
    @ownyounext 3 ปีที่แล้ว

    Thank you for this simple explanation!!

  • @sourabsen9679
    @sourabsen9679 2 ปีที่แล้ว

    Thank you

  • @santiagoperez6769
    @santiagoperez6769 2 ปีที่แล้ว

    Wonderful and succinct explanation... thank you!

  • @tastytreat0133
    @tastytreat0133 5 ปีที่แล้ว

    you saved my grade... thank you very much

  • @anmjubaer
    @anmjubaer 3 ปีที่แล้ว

    Nicely explained. Thanks.

  • @beautyofnews1771
    @beautyofnews1771 4 ปีที่แล้ว

    really love your explanation style and subscribed

  • @gulkhancs3929
    @gulkhancs3929 ปีที่แล้ว

    fan ho gaye hum aapki awaaz ke

  • @ervinboljo415
    @ervinboljo415 3 ปีที่แล้ว

    thank you i love your explanation

  • @akshayvakharia7552
    @akshayvakharia7552 2 ปีที่แล้ว

    Thank you for very good explanation :)

  • @laujimmy9282
    @laujimmy9282 ปีที่แล้ว +1

    I have a question :
    Wouldn't the first loop go n times instead of n - 1 times ?
    Because it will need to run once more after i = 1 and change it to i = 0 before exiting the loop ?
    [edit]
    ok, I think I got it, since it skipped i = 0, it will only run n-1 times.
    thx

  • @supperytube
    @supperytube 2 ปีที่แล้ว

    excellent keep it up!

  • @arturmarchi7348
    @arturmarchi7348 3 ปีที่แล้ว

    very clear, perfect, thank you

  • @Brolyonic
    @Brolyonic 5 ปีที่แล้ว +1

    Thank You

  • @aryasarkar3514
    @aryasarkar3514 2 ปีที่แล้ว +1

    Mam arr[j]=arr[j+1] ,i think it will take time 3x because there are three primitive operation .
    Mam requesting you to solve my doubt.

  • @cemtopkaya3422
    @cemtopkaya3422 4 ปีที่แล้ว

    Wonderful explanation, thank you so much.

  • @rahulvarma7257
    @rahulvarma7257 4 ปีที่แล้ว

    wonderful explanation

  • @techdevafrica2485
    @techdevafrica2485 4 ปีที่แล้ว +4

    arr[j] = arr[j+1] ; is not 3 primitive operations (2 indexing and one assignment) ???

    • @techdevafrica2485
      @techdevafrica2485 4 ปีที่แล้ว

      May be j+1 is another primitive operation

  • @technicalexpertise
    @technicalexpertise ปีที่แล้ว

    Yaar, your voice really awesome

  • @spbirhade
    @spbirhade 2 ปีที่แล้ว

    Very nice

  • @malikdanialahmad7662
    @malikdanialahmad7662 5 ปีที่แล้ว +1

    thank you so much...

  • @cocoarecords
    @cocoarecords 4 ปีที่แล้ว

    Thanks a ton mam veri clear and straightforward

  • @LukiShafer
    @LukiShafer 3 ปีที่แล้ว

    ty, u saved me

  • @gt3rs780
    @gt3rs780 4 ปีที่แล้ว

    Thank you so much

  • @wahidsafi9926
    @wahidsafi9926 4 ปีที่แล้ว

    Fabulous..

  • @Darkknight9035
    @Darkknight9035 2 ปีที่แล้ว

    best case?

  • @malikansar8289
    @malikansar8289 5 ปีที่แล้ว +1

    thanks mam

  • @victordarius1442
    @victordarius1442 4 ปีที่แล้ว

    Thank you subscribed and liked.

  • @jarunajaruna8995
    @jarunajaruna8995 ปีที่แล้ว

    madam how to find best case time complexity ? could you please explain?

  • @louise1021
    @louise1021 4 ปีที่แล้ว +1

    Why is it 11/2n*2 - 11/2n?

  • @allarinani3476
    @allarinani3476 4 ปีที่แล้ว +1

    Mam ur voice is sweet❣ and well explained.

  • @iExplorer64
    @iExplorer64 2 ปีที่แล้ว

    why did you only explain worst case, but not best case or average case?

  • @musabraees7188
    @musabraees7188 3 ปีที่แล้ว

    can u please upload videos related to calculate time complexity of best case of sorting algorithms

  • @raghunathan3244
    @raghunathan3244 5 ปีที่แล้ว +1

    Kindly explain 5.35 in brief manner i.e J loop iteration part

  • @skbelalsaheb4437
    @skbelalsaheb4437 5 ปีที่แล้ว +1

    you made a mistake with the second for loop
    mean
    you have write :- for(j=0;j

    • @LalithaNatraj
      @LalithaNatraj  5 ปีที่แล้ว +3

      To clear your doubt, in the code shown in the video, the greatest element is being shifted to the last index each time thereby sorting it. This is an alternate approach to bubble sort. I recommend you to watch the video explaining this pseudo code, named "Bubble Sort - Pseudo Code". This code, once implemented in C++ or java will work.

  • @listenuptosaumyadipta9416
    @listenuptosaumyadipta9416 4 ปีที่แล้ว

    Mam your voice is so sweet♥️♥️♥️♥️

  • @AZ-gm9ol
    @AZ-gm9ol ปีที่แล้ว

    first of all, I should thank you for your great presentation.
    the thing I could not understand is that how I can interpret the relationship between the worst case and big oh generated from the time function
    I would be grateful if you could help me understand it

    • @AZ-gm9ol
      @AZ-gm9ol ปีที่แล้ว

      I realized my misunderstanding. we write the worst and best case for our algorithm while I was thinking 2 different algorithms were assigned to both the worst and best case respectively

  • @surajkeshari9991
    @surajkeshari9991 3 ปีที่แล้ว

    Thank you Mam,mai exam aktu ds ko lekar pareshan hu aapane help kia,c programming aur algorithm aache se sikhane ke lia kya kare mam,please reply??😇😇

  • @VivekSharma-rl5vf
    @VivekSharma-rl5vf 2 ปีที่แล้ว

    mam aapki aavaz AI mein jo human voice invoked hoti hai us jaisi hai

  • @malikdanialahmad7662
    @malikdanialahmad7662 5 ปีที่แล้ว

    and please upload insert sort time complexity and (best case, worse case,)??

    • @lutherlivaiwii3863
      @lutherlivaiwii3863 5 ปีที่แล้ว

      How to make balance sheets of financial statements

  • @abdulmubeen9473
    @abdulmubeen9473 4 ปีที่แล้ว

    analyze the following code and compute its complexity.
    a)
    // C++ program for implementation of Bubble sort
    #include
    using namespace std;

    void swap(int *xp, int *yp)
    {
    int temp = *xp;
    *xp = *yp;
    *yp = temp;
    }

    // A function to implement bubble sort
    void bubbleSort(int arr[], int n)
    {
    int i, j;
    for (i = 0; i < n-1; i++)

    // Last i elements are already in place
    for (j = 0; j < n-i-1; j++)
    if (arr[j] > arr[j+1])
    swap(&arr[j], &arr[j+1]);
    }

    /* Function to print an array */
    void printArray(int arr[], int size)
    {
    int i;
    for (i = 0; i < size; i++)
    cout

    • @supperytube
      @supperytube 2 ปีที่แล้ว

      not easily calculate, the only calculated by computers

  • @suniltv968
    @suniltv968 2 ปีที่แล้ว

    If u write any word u should know the meaning without meaning should not be explain it's iretating, ok u said t(n) =11/2 n(square) then according to ap where is -1if any one knows the answer plzz comment here

  • @ShahidAli-cm7fh
    @ShahidAli-cm7fh 4 ปีที่แล้ว

    Asslam Aliakum!
    Anyone help please.
    You are required to calculate (Step by Step) the worst case time complexity T(n) of the algorithm designed.
    what will be the time complexity T(n) of this code?
    #include
    using namespace std;
    main()
    {
    int number, temp;
    int reverse = 0;
    cin>>number;
    temp=number;
    while (number>0)
    {
    reverse = (reverse*10) + number%10;
    number=number/10;
    }
    if(temp == reverse)
    cout

  • @muhammadozair9432
    @muhammadozair9432 3 ปีที่แล้ว

    Lalitha Natraj let me know the email ID.

  • @aagaming.1998
    @aagaming.1998 5 ปีที่แล้ว +1

    Thank you