ECET370 Lab 5
Scenario and Summary
The purpose of the lab exercises is to help the student acquire skills in developing programs that involve search algorithms and techniques.
There are four exercises in this lab, although not all of them will be required for submission. Be sure to read the following instructions carefully.
Exercise 1: No submission is required.
Note that one of the exercises requires sections of code to be timed. To review how to time a section of your source code, please refer to the beginning of the Projects section in Chapter 4 of our textbook.
Exercise 2 requires not only software development but also explanations about the results of the experiments that are conducted. Create a separate Word document to provide the details required in the exercise.
Create a folder and name it Week 5 Lab. Inside this folder, create the subfolders Ex2, Ex3, and Ex4. Place the solution to each of the three exercises required for submission in the corresponding subfolder. Compress the folder Week 5 Lab using a program like WinZip, and place the resulting zipped folder into the Dropbox.
Note that Exercises 2, 3, and 4 require software development. Place in the corresponding folders only .java files. Do not submit the .class files or other files or folders that are generated by the IDE.
Access the software at https://lab.devry.edu .
Exercise 1: Review of the Lecture Content
Back to Top
Create a project using the ArrayList class and the Main class provided in Doc Sharing. The ArrayList class contains implementations of the first three search methods explained in this week’s lecture: sequential, sorted, and binary search. The Main class uses these three methods. These programs test the code discussed in the lecture. Compile the project, run it, and review the code that is given carefully.
Exercise 2: Search Algorithms and Techniques
Back to Top
Expand the project developed in the previous exercise to perform the following experiment: Time the sequential search and the binary search methods several times each for randomly generated values, and record the results in a table. Compare the running times of these two search methods that are obtained during the experiment.
Regarding the efficiency of both search methods, what conclusion can be reached from this experiment? Both the table and your conclusions should be included in a separate Word document.
Exercise 3: Searching Applications
Back to Top
Select one of the following two problems to solve.
Problem 1: Design and implement an algorithm that determines whether or not a given array of elements, list1, is completely contained within another given array of elements, list2. Consider two different scenarios: (1) both arrays are sorted and (2) both arrays are unsorted.
Problem 2: Design an algorithm that, when given a collection of integers in an unsorted array, determines the second smallest number (or second minimum). For example, if the array consists of the values 12, 23, 9, 17, and 3, the algorithm should report the value 9, because it is the second smallest number in the array. Write a function that receives an array as a parameter and returns the second-smallest number. To test your function, write a program that populates an array with random numbers and then call your function.
Exercise 4: Hashing
Back to Top
Suppose that the type of key in a hashing application you are implementing is string (Sections 21.7 and 21.8 in our textbook explain hash functions for strings). Design, implement, and test a hash function that converts a key to a hash value.
Here is compete solution for ECET370 Lab 5
If you have more questions, please contact me via email firstname.lastname@example.org
I will help you any time