You are on page 1of 2

Two Searching Algorithm

Part 1.
The objectives of this particular case study are:
1. To learn the different searching algorithms and their behaviors.
2. To be able to implement two searching algorithms, namely: linear and binary search in C++ programming
language.
3. To observe the relative performance of these different searching algorithms.
4. To explore programming involving the use of arrays and get to see arrays properties and way of manipulating
data.
5. To strengthen the discipline of self-study.

Part 2
Requirements: Write a C++ program that will do the following in sequence:
Linear Search
1. Ask the user to input a positive integer value that we will denote as n. Here n represents the size of the
problem space, specifically, the number of random elements.
2. For linear search, the user will input the key/value that will be searched.
3. Once the key/value is found it will display the value including the index value.
4. It will also display the time that it searched in milliseconds.

Binary Search
1. Ask the user to input a positive integer value that we will denote as n. Here n represents the size of the
problem space, specifically, the number of random elements.
2. For binary search, the random number will be arranged in ascending order.
3. The user will input the key/value that will be searched.
3. Once the key/value is found it will display the value including the index value.
4. It will also display the time that it searched in milliseconds.

n linear search binary search


processing time key processing time key
32
64
128
: :
: :

32768
65536

Note: the next value of n is computed as n = n * 2. For example, after n = 64 the next n is computed as 64 * 2 =
128.
General Requirements:
1. You are to submit all the works did in this project in both printed document and electronic form on or before
the specified due date. Submission of the printed document should be in A4 bond paper with short, white
sliding folder. Submission of both versions must be done on the same day. In the event that one of the
requirements is submitted at the latter date, that date will be considered as individuals submission.
2. This project is mandatory for all the students in the lecture and laboratory class.
3. For the electronic version of your assignment: use the concatenated last names as filename and .cpp as the
extension. For example if your last name is SANTOS, the file name should be santos.cpp (for C++ program). PDF
version on the tables and other needed documents. Email the electronic version to
____________________________ with subject heading as: PrelimProject-<Lastname of Person 1 (ID#)>. For
example: MidtermProject-Santos(100893454).
4. The printed document should contain the following:
- An introduction of the prelim project
- A presentation, discussion and illustrations of Part 2.
5. The printed document should be written in single-spaced, font name: Arial, font size: 11 with one- inch
margin on each side.
6. Cover page with title, names of members are included. Timeline (using MS Project) should be at the last
page.

Design Day: (Project Defense) on ____________________________.

You might also like