Enrol to start learning
Reading is open to everyone. Enrolling is free, and it is what unlocks the audio lessons, practice tests and progress tracking.
11.1.4. In-Place Selection Sort
This section
Practice test
12 questions on this section. Wrong answers show you what to read again.
Sign up to take itWhole chapter
Revision test
Mixed questions from across the chapter. Your answers get marked.
Sign up to take itQuick
Flashcard drill
4 cards from this lesson. Good the night before a test.
Try these first
- 1.
What is the time complexity of the selection sort algorithm?
Hint
Think about how many times we have to scan through the list.
- 2.
In an unsorted array, which element do we look for first with selection sort?
Hint
Consider what we mean by sorting into order.
- 3.
What is the first step in the selection sort algorithm?
- Swap the last two elements
- Find the smallest element
- Sort the entire array
Hint
Recall the initial action when you start sorting.
- 4.
Selection sort is considered best suited for?
- Large datasets
- Small datasets
- Any datasets
Hint
Think about where the algorithm might perform well.
- 5.
Write a function that implements selection sort in a programming language of your choice. Explain the steps involved in the code clearly.
Hint
Remember to check boundaries when accessing array indices.
- 6.
Given an array of integers, find out how many swaps are performed by a selection sort on it. Write code to illustrate this.
Hint
Consider implications of finding minimums and when actual swaps occur.
Exercises
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
4 more questions available
Enrol freeQuiz
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting
2 more questions available
Enrol freeChallenge Problems
Total Questions
2
Estimated Time
4 min
Passing Score
70%
Instructions
- Read each question carefully
- You can use hints if you need help
- Complete all questions before submitting