[Solved] CSE1321 Lab14- Search and Sort Algorithms

$25

File Name: CSE1321_Lab14-_Search_and_Sort_Algorithms.zip
File Size: 386.22 KB

SKU: [Solved] CSE1321 Lab14- Search and Sort Algorithms Category: Tag:
5/5 - (1 vote)

Exercise #1: Design and implement a program (name it LinearBinarySearch) to implement and test the linear and binary search algorithm discussed in the lecture slides.

Define method LinearSearch() to implement linear search of an array of integers. Modify the algorithm implementation to count number of comparisons it takes to find a target value (if exist) in the array.

Define method BinarySearch() to implement binary search of an array of integers. Modify the algorithm implementation to count number of comparisons it takes to find a target value (if exist) in the array.

Now, develop a test method to read integer values from the user in to an array and then call methods LinearSearch() and BinarySearch() and printout the number of comparison took to find the target values using each search method. Document your code and organized your outputs as follows:

Arrays Values:

Target value:

Linear Search Comparisons:

Binary Search Comparisons:

Exercise #2: Design and implement a program (name it SimpleSort) to implement and test the three sort algorithms (Bubble, Insertion, Selection) discussed in the lecture slides.

Define method BubbleSort() to implement Bubble sort of an array of integers. Modify the algorithm implementation to count number of swaps it takes to sort the array.

Define method InsertionSort() to implement insertion sort of an array of integers. Modify the algorithm implementation to count number of swaps it takes to sort the array.

Define method SelectionSort() to implement selection sort of an array of integers. Modify the algorithm implementation to count number of swaps it takes to sort the array.

Now, develop a test method that generates 50 integer values between 0 and 100, store them in an array, and then pass the array to those three sort methods. Document your code and organized your outputs as follows:

Arrays Values:

Bubble Sorted values:

Bubble Sort Swaps:

Insertion Sorted values:

Insertion Sort Swaps:

Selection Sorted values:

Selection Sort Swaps:

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSE1321 Lab14- Search and Sort Algorithms
$25