2014-12-04

posted Dec 3, 2014, 7:00 PM by Samuel Konstantinovich   [ updated Dec 3, 2014, 7:11 PM ]
You must know the following sorts for the AP:
selection sort (you will learn this soon)
insertion sort
merge sort (you will learn this 2nd semester)

In addition to sorting you need to know how to search for something using:
linear search  
binary search

Note that for StuyCS you are required to know much more. 
We will go over many more sorts later. 
Including but not limited to: radix    quick    bubble    heap

Today, I assume you have a functional insertionSort()

Consider the following method :
int find(String target)
The method should return the smallest index of an element in your List that matches the target string. (The index of the left most matching element)

You must add it to BOTH your SuperArray and OrderedSuperArray.


BEFORE YOU WRITE ANY CODE:
Take out your notebook. Write your name/date on the top of a piece of paper. You will write some answers down:

-Discuss with others and WRITE DOWN ANSWERS: 
1. What algorithm should be used for searching in the SuperArray vs the OrderedSuperArray, why?
2. What happens if you find the target on the 1st try in the linear search? (remember you want the smallest index that has the target value)
3. What happens if you find the target on the 1st try in the binary search?(remember you want the smallest index that has the target value)
4. At the bottom of the page write the word "Thanks to the following people"
5. Have at least 2 people that you discussed these questions with with write their names on the paper. 



Comments