Doubt in selection sort

what is difference between selection sort and bubble sort as we are just comparing the nos at particular index and swaping in both the cases. so what is the specific difference and advantage of these sorting methods.

@harsh.hj hi bro, both are different techniques of sorting if you closely observe!
bubble sort operates by repeatedly swapping the adjacent elements if they are in the wrong order while the selection sort sorts an array by repeatedly finding the minimum element from the unsorted part and placing that at the beginning of the array

which method is better ???

@harsh.hj basically that varies from case to case.
For example :- In sorted array bubble sort has linear time as compared to selection sort quadratic time.
But in worst case:- bubble performs more swaps then selection sort

So That’s why you have to analyze the cases and use the perfect one.

If your query is cleared mark it resolved and rate full else feel free to ask bro!