programming practice
programming practice
(Selection Sort)
Question # 01:
Imagine a scenario in a school where a teacher wants to rank students based on their scores in a
final exam, from the highest to the lowest. The teacher could go through the list of students, find
the student with the highest score, and place them at the top. Then, the process is repeated for the
remaining students, finding the next highest score and placing it accordingly.
Scenario Description: "A teacher is arranging students in order of their scores, where they
repeatedly find the highest score among the unsorted students and place that student at the front
of the list. This process continues until all students are sorted in descending order of their exam
results."
Question # 02:
A bookstore wants to arrange books on the shelves based on their prices in increasing order.
They could start by looking at all the books, identify the book with the lowest price, and move it
to the front of the shelf. Then, they repeat the process for the remaining books, always selecting
the book with the lowest price from the unsorted section.
Scenario Description: "In a bookstore, the staff members are arranging the books by price. For
each step, they identify the least expensive book from the unsorted collection and place it in its
correct position. This continues until all the books are ordered from the least to the most
expensive."
Question # 03:
When booking a hotel for a vacation, a traveler might want to choose the cheapest available
room. They start by looking at all the rooms and selecting the one with the lowest price. Once
they have picked the cheapest, they move on to find the next cheapest room among the
remaining options.
Scenario Description: "A traveler is looking for the cheapest hotel room for their stay. They
review all available rooms, select the one with the lowest price, and then look at the remaining
options, finding the next lowest price. This continues until the cheapest room is selected."
Question # 04:
A store manager is responsible for arranging products on shelves based on their expiration dates.
To minimize waste, the products with the earliest expiration dates should be placed at the front.
The manager could go through the inventory, select the item with the earliest expiration, and
place it in the correct position.
Scenario Description: "A store manager is arranging items on the shelf based on their expiration
dates. They go through the list of products, find the item with the earliest expiration, and place it
in the front. They then repeat this process, placing each subsequent item in the correct position
based on its expiration date."
Question # 05:
A project manager has a list of tasks, each with a deadline. They want to prioritize tasks by their
deadlines, with the earliest deadline taking precedence. The manager can go through the list, find
the task with the earliest deadline, and place it at the top of the schedule. Then, they continue
with the next task with the next earliest deadline.
Scenario Description: "A project manager is organizing tasks by their deadlines. They start by
identifying the task with the earliest deadline and place it at the top of the list. They then find the
next task with the shortest deadline and position it accordingly. This process continues until all
tasks are ordered by their deadlines."
Question # 06:
A sports coach has a list of players and wants to organize them by age, starting from the
youngest to the oldest. The coach can go through the list, find the youngest player, and place
them at the front. Then, the same process is done for the remaining players, finding the next
youngest.
Scenario Description: "A sports coach needs to organize team members by age, from youngest
to oldest. They begin by identifying the youngest player and placing them at the beginning of the
list. Then, they continue with the next youngest player and place them in the correct order,
repeating until all players are arranged."