Selection Sort
Elementary Sorting Algorithms DSA practice problem on Onlearn.
Difficulty: easy.
Topics: Selection Sort Algorithm Implementation and Analysis, Sorting, Arrays, Loops, Time Complexity, Space Complexity, Big O Notation, space complexity, sorting algorithms, array manipulation, iterative sorting, time complexity analysis, Selection Sort, Sorting Algorithms.
Problem Statement Given an array arr of N integers, implement the Selection Sort algorithm to sort the array in non decreasing order. Input Specification The first line of input contains an integer N, representing the size of the array. The second line contains N space separated integers, representing the elements of the array arr. Output Specification Output the sorted array with elements separated by spaces. Sample Test Cases Example 1: Input: Output: Explanation: After sorting the array is: 9, 13, 20, 24, 46, 52 Example 2: Input: Output: Explanation: After sorting the array is: 1, 2, 3, 4, 5