Read the algorithm and identify the type of sorting used in it. Set A = 0…

2023

Read the algorithm and identify the type of sorting used in it. Set A = 0 WHILE (not sorted yet) find the smallest unsorted item Swap first unsorted item with the smallest Set A to A + 1

Answer: C. SelectionThe algorithm works as follows: It initializes a variable A to 0. It then repeatedly finds the smallest unsorted item and swaps it with the first unsorted…

  1. A.

    Binary

  2. B.

    Insertion

  3. C.

    Selection

  4. D.

    Bubble

  5. E.

    Question not attempted

Attempted by 1010 students.

Show answer & explanation

Correct answer: C

The algorithm works as follows: It initializes a variable A to 0. It then repeatedly finds the smallest unsorted item and swaps it with the first unsorted item, incrementing A by 1 each time. This process continues until the entire list is sorted. This method of repeatedly selecting the smallest element and placing it in the correct position is characteristic of selection sort. In selection sort, the algorithm divides the list into sorted and unsorted parts. In each iteration, it finds the minimum element from the unsorted part and swaps it with the first element of the unsorted part. Therefore, the sorting method used in the algorithm is Selection Sort.

Explore the full course: Rssb Basic Computer Instructor

Loading lesson…