At the time of sorting an array of size N by normal selection sort, the number of comparisons made in first iteration is :

This question was previously asked in
NIELIT Scientific Assistant IT 5 Dec 2021 Official Paper
View all NIELIT Scientific Assistant Papers >
  1. N
  2. N−1
  3. Nx(N−1/2)
  4. NlogN

Answer (Detailed Solution Below)

Option 2 : N−1
Free
NIELIT Scientific Assistant Quantitative Aptitude Mock Test
0.7 K Users
20 Questions 20 Marks 30 Mins

Detailed Solution

Download Solution PDF

The correct answer is: option 2: N−1

Concept:

In the Selection Sort algorithm, during each iteration, we find the smallest (or largest) element from the unsorted portion of the array and place it at the correct position.

In the first iteration:

  • You compare the first element with all the other N−1 elements to find the minimum.
  • So, the number of comparisons made in the first iteration is exactly N−1.

General selection sort comparison count:

  • Total comparisons = (N−1) + (N−2) + ... + 1 = N(N−1)/2

Explanation of options:

  • Option 1 – N: ❌ Too many, only N−1 comparisons are needed.
  • Option 2 – N−1:Correct. This is the actual number of comparisons in the first iteration.
  • Option 3 – N×(N−1)/2: ❌ This is the total number of comparisons in the entire sorting process, not just the first iteration.
  • Option 4 – NlogN: ❌ This is the time complexity of more efficient algorithms like Merge Sort or Heap Sort, not Selection Sort.

Hence, the correct answer is: option 2: N−1

Latest NIELIT Scientific Assistant Updates

Last updated on Jun 12, 2025

-> NIELIT Scientific Assistant city intimation slip 2025 has been released at the official website.

-> NIELIT Scientific Assistant exam 2025 is scheduled to be conducted on June 28. 

-> A total number of 113 revised vacancies have been announced for the post of Scientific Assistant in Computer Science (CS), Information Technology (IT), and Electronics & Communication (EC) streams.

-> Online application form, last date has been extended up to from 17th April 2025.

->The NIELT has revised the Essential Qualifications for the post of Scientific Assistant. Candidates must possess (M.Sc.)/ (MS)/ (MCA) / (B.E.)/ (B.Tech) in relevant disciplines.

 

-> The NIELIT Scientific Assistant 2025 Notification has been released by the National Institute of Electronics and Information Technology (NIELIT).

More Sorting Questions

Get Free Access Now
Hot Links: teen patti royal teen patti neta dhani teen patti teen patti winner