ECET 370 Devry Course-ShopTutorial
17 views | +0 today

# ECET 370 Devry Course-ShopTutorial

Curated by red11
 Scooped by red11

## ECET 370 Week 5 Lab 5 Search Algorithms - ShopTutorial.com

ECET 370 Week 5 Lab 5 | Compare the running times of the three search methodswhich are obtained during the experiment.

red11's insight:

ECET 370 Week 5 Lab 5 Search Algorithms

For more course tutorials visit

www.shoptutorial.com

Exercise 1 uses the programs in DocSharinglabeled “Search algorithms.”

Exercise 1: Review of the Lecture Content Create a project using the ArrayList class and the Main class provided in DocSharing. 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 Expand the project developed in the previous exercise to perform the following experiment: time the three search methods several times each and record the results. Compare the running times of the three search methods (sequential search, sorted search, and binary search) which are obtained during the experiment. What conclusions can be drawn?

Exercise 3: Searching Applications 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; 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, 3, the algorithm should report the value 9, since 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 Suppose that the type of key in a hashing application you are implementing is String (Sections 19.6 and 19.7 in our textbook explain hash functions for strings). Design, implement, and test

No comment yet.
 Scooped by red11

## ECET 370 Week 1 Lab 1 - ShopTutorial.com

ECET 370 Week 1 Lab 1 | User-defined methods The function area of the Triangle class is the framework of the actual method.
red11's insight:

For more course tutorials visit

www.shoptutorial.com

General Instructions
Exercises 1, 2, 4, and 5 use the programs in DocSharinglabeled “User-defined classes.”
Exercises 7 and 8 use the programs in DocSharinglabeled “Using interfaces.”
Exercise 1: Review of classes Create a project using the classes in the DocSharing area labeled “User-defined classes.” Compile it, run it, and review the code that is given carefully.
Exercise 2: User-defined methods The function area of the Triangle class is the framework of the actual method. Modify it so that it calculates the area of the triangle. Write a Main class to test your area method. Note: to calculate the area of a triangle from the vertices, first find the distances between each pair of vertices to obtain the length of the sides of the triangle. Then apply Heron’s formula to calculate the area given the length of the sides.
Exercise 3: Shallow versus deep copy Provide an example of shallow copy of objects and an example of deep copy of objects.
Exercise 4: Passing parameters to methods Write a function that swaps two Point objects. Use the code given below: import java.util.*; public class Main { public Main() { Scanner Scanner(System.in); System.out. print(“Enter x and y coordinates of first point: “); Point Point (in.nextDouble(), in.nextDouble()); System.out. print(“Enter x and y coordinates of second point: “); Point Point (in.nextDouble(), in.nextDouble()); swap(p1, p2); System.out.println(” Compile it, run it, and review the code that is given carefully. Note: The class Point implements the Comparable interface. The Comparable interface contains a single method: compareTo, which is used to compare two objects p and q of the same class type. When calling p.compareTo(q), it returns an integer. If this value is negative it means that p is smaller; if it is equal to zero then , and if the value is positive, it indicates that p is greater than q.
Exercise 8: Implementation of interfaces Using the class Point in the DocSharing area labeled “Using interfaces,” write an application that declares an array of Points, fills the array with random points, and finds the smallest point in the array.

No comment yet.
 Scooped by red11

## ECET 370 Week 4 Lab 4 Complexity of Computational - ShopTutorial.com

ECET 370 Week 4 Lab 4 | Efficiency of Algorithms Problem 2 in the Section “Projects” at the end of Chapter 9 in the textbook
red11's insight:

ECET 370 Week 4 Lab 4 Complexity of Computational

For more course tutorials visit

www.shoptutorial.com

Exercise 1 uses the programs in DocSharinglabeled “Minimum,” “Factorial,” and “Sorting algorithms.”
Exercise 1: Review of the Lecture Contents Create projects using the classes in the DocSharing areas labeled “Minimum,” “Factorial,” and “Sorting algorithms.” Compile them, run them, and review the code that is given carefully. These programs test the code discussed in the lecture.
Exercise 2: Efficiency of Algorithms Problem 2 in the Section “Projects” at the end of Chapter 9 in the textbook: find a value of n for which Loop B is faster.
Exercise 3: Recursion Problem 1 in the Section “Projects” at the end of Chapter 10 in the textbook: recursive algorithm to find the square root of a given number. Exercise 4: Sorting In this week’s lecture, the algorithms quicksort and bubblesort are described and implemented. In DocSharing, under the section labeled “Sorting algorithms,” you can find the class ArrayList where these sorting algorithms are implemented. Write a Java program that times both of them for various values of n. Create a table to record the times. Regarding the efficiency of both sorting methods, what conclusion can be reached from this experiment? Note: You can probably save development time by using the program from Week 2 to generate a list of the 1000 smallest

No comment yet.
 Scooped by red11

## ECET 370 Entire Course - ShopTutorial.com

ECET 370 Entire Course | Complexity of Computational Problems
red11's insight:

ECET 370 Entire Course

For more course tutorials visit

www.shoptutorial.com

ECET 370 Week 1 Lab 1
ECET 370 Week 2 Lab 2
ECET 370 Week 3 Lab 3 Linked Lists
ECET 370 Week 4 Lab 4 Complexity of Computational Problems
ECET 370 Week 5 Lab 5 Search Algorithms and Techniques
ECET 370 Week 7 Lab 7 Binary Trees

No comment yet.