Lab 8

Submitted by: Submitted by

Views: 99

Words: 653

Pages: 3

Category: Science and Technology

Date Submitted: 04/25/2014 08:24 PM

Report This Essay

 

 

                 

LESSO N S E T

8

 

     

Searching and Sorting Arrays

                                         

PURPOSE

     

1. 2. 3. 4.

To introduce To introduce To introduce To introduce

the concept of a search routine the linear and binary searches the concept of a sorting algorithm the bubble and selection sorts

PROCEDURE

   

1. Students should read the Pre-lab Reading Assignment before coming to lab. 2. Students should complete the Pre-lab Writing Assignment before coming to lab. 3. In the lab, students should complete labs assigned to them by the instructor.

 

 

 

 

Contents Pre-lab Writing Assignment LESSON 8A Lab 8.1 Working with the Linear Search Lab 8.2 Working with the Binary Search Lab 8.3 Working with Sorts LESSON 8B Lab 8.4 Student Generated Code Assignments

 

Pre-requisites Pre-lab reading

Approximate   completion Page time number 20 min. 10 min. 138 148

Check when done

Pre-lab Reading Assignment  

 

Understanding of character arrays Understanding of integer arrays Understanding of arrays

 

 

15 min. 149

 

 

       

 

 

20 min.

150

 

 

 

15 min.

152

       

 

Understanding of arrays

 

50 min. 156

 

 

 

 

               

 

137

 

           

 

138 LESSON 8 Searching and Sorting Arrays

 

 

PR E- L AB R E A D ING ASSI GN MENT

Search Algorithms

 

  A search algorithm is a procedure for locating a specific datum from a collection of data. For example, suppose you want to find the phone number for Wilson Electric in the phonebook. You open the phonebook to the business section under W and then look for all the entries that begin with the word Wilson. There are numerous such entries, so you look for the one(s) that end with Electric. This is an example of a search algorithm. Since each section in the phonebook is alphabetized, this is a particularly easy search. Of course, there are numerous...