Selection Sort - Time Complexity

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ต.ค. 2024

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

  • @riteshchaudhary7784
    @riteshchaudhary7784 2 ปีที่แล้ว +7

    This was the only video where all my doubts regarding theoretical time complexity is cleared. Watching this just 5 min before exam ..Thank you so much :P

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

    Thank you for the great explanation with much details, I am a Computer Science and this video benefited me a lot since I am currently taking Data Structure and Algorithm course.

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

    Thank you again Lalitha. This was very informative and very well explained.

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

    if the 1st for loop the statement arr[i] = arr[min_index]
    don't you think it has 3*(N-1) primitive operation ?? please reply
    if not why??
    N yes the tutorials are very helpful thank you for that
    😄

  • @samruddhibhor6769
    @samruddhibhor6769 6 หลายเดือนก่อน

    Thank u mam. Easy to learn with you

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

    Can you do the best case complexity of bubbule,linear,insertion and selection sort

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

    Thank you so much. Can you explain that for HeapSelection as well?

  • @gokulannam262
    @gokulannam262 7 หลายเดือนก่อน

    for J loop there will be failed cases also know? so will it be (x+N-1) instead of (x+1) for j loop condition

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

    thanks

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

    thr j loop runs
    (n(n-1)/2)-1 for n=5
    (5(4)/2)-1=9
    the series doesn't include first element as its considered sorted and the loop skips it so j doesn't start at 0 index it starts at 1 the correct formula is above

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

      If I'm correct, if you pay attention, she started the indexing at i+1 (so 1), not at i (so at 0).
      So, I think she had it right.

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

    crazy good, big thanks :D

  • @rahiqal-makhtum2107
    @rahiqal-makhtum2107 2 ปีที่แล้ว

    thank you so much for this video

  • @carloslopez-cacheux7741
    @carloslopez-cacheux7741 2 ปีที่แล้ว

    Tested the code and it does not work. It only moves the lowest value in the array to almost the last slot in the array, but the for loop does not even get there because it is set to stop at i < [length - 1] which is [length - 2]

  • @Hacker-vq3xk
    @Hacker-vq3xk 3 ปีที่แล้ว +2

    what will be best case? define both

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

      Selection sort doesn't have any worst case, j loop always runs for n^2 times. T(n)=Theta(n^2)
      Only swaps will be 0 at best case and n at worst case

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

    Mam staring loop ki primitive operation is n hoga .
    Becoz. I=5 then I=0,1,2,3,4 भी ayegana

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

    libdash