?

AP® Computer Science Principles

Free Version

Upgrade subject to access all content

Moderate

Why Do We Learn Sorting Routines?

APCSP-NYGDME

When learning to program, computer scientists often learn a number of different algorithms for sorting a list. Some of these algorithms are known by names such as insertion, selection, bubble, shell, and merge.

You may have learned some of these in your own computer science courses. Yet most modern computer languages have a command built-in that looks something like:

PROCEDURE sort (list)
{
   // code that returns the list sorted
}

Given that many modern languages have built-in sort routines, why do we still make students learn a variety of different sorting algorithms?

Select TWO answers.

A

One can build upon a variety of known algorithms to build new algorithms.

B

Since previous generations of programmers have needed to know these algorithms, future generations should learn them as well.

C

In case you find an error in the sorting that your language is producing, you can recreate the algorithm and fix the bug in the language.

D

Starting with known, correct algorithms can help ensure that new algorithms based upon the known algorithms are correct.