Top Topics in our Forum';
**Create your own pie chart with ChartMaker

A+    A−    B  
Algebra
Games
Geometry
Interactive
Trigonometry
Forum




AddThis Social Bookmark Button

Sorts testable on the AP Computer Science Exam

Selection Sort, Insertion Sort, Merge sort and more

Big-Oh of Sorts (AB only)
    Sorts testable on A and AB exams
  • Insertion Sort
  • Selection Sort
  • Merge Sort
  • * Bubble Sort (not on either AP exam but it's an easy one)
  • **Heap Sort (AB only)
  • **Quick Sort (AB only)

    Part I. Researching and Analyzing

  • Investigate each of the sorts listed up above and be prepared to describe each one. You should be able to state
    • How efficient the algorithm is.
    • How does the algorithm 'work'.
      • ie. How does the algorithm sort its elements?
    • How does the efficiency of the algorithm relate to the starting order of its elements?
      • If the algorithm's efficiency varies, is the variation great or neglible?

II. Improve the Sort Algorithm below

Create a class that uses the snippet of code below to sort an array a[].
First, determine which sort the algorithm below uses. Your job is to rewrite the code so that it implements a more efficient use of the of the sort you just identified. ie if you determine that code below is an implementation of MergeSort, rewrite the code to become a better implementation of MergeSort.
        
    for(i = 0; i <a.length -1; i++) for(j=i+1;j<a.length;j++) if(a[i] > j[i]) swap();//implementation of swap not shown
III. Presentation of Sorting Algorithm
Download Activity

Top
AddThis Social Bookmark Button