हिंदी

Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons. - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

Identify the number of swaps required for sorting the following list using selection sort and bubble sort and identify which is the better sorting technique with respect to the number of comparisons.

List 1:

63 42 21 9
टिप्पणी लिखिए

उत्तर

Number of swaps required for sorting the following list using selection sort: 3

Number of swaps required for sorting the following list using bubble sort: 6

Selection sort performs less swaps than bubble sort; as a result, despite the fact that both sorting methods are O(N2), selection sort is faster and more effective.

shaalaa.com
Bubble Sort
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 5: Sorting - Exercise [पृष्ठ ७९]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
अध्याय 5 Sorting
Exercise | Q 2. | पृष्ठ ७९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×