Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a java program that runs on the Eclipse. Java Programming 2-6: Sorting a

ID: 3849572 • Letter: T

Question

This is a java program that runs on the Eclipse.

Java Programming 2-6: Sorting and Searching Practice Activities Lesson objectives: Recognize the sort order of primitive types and objects Trace and write code to perform a simple Bubble Sort of integers Trace and write code to perform a Selection Sort of integers Trace and write code to perform a Binary Search of integers Compare and contrast search and sort algorithms Analyze the Big-O for various sort algorithms Vocabulary Identify the vocabulary word for each definition below. Also called a linear search, an algorithm that searches through an array until a value is found. The array does not need to be sorted An algorithm that finds the minimum value in an array and swaps that value with the first number in the array. The next smallest value is swapped with the second number in the array. The process is repeated until the array is sorted. An algorithm that checks the value of the first two elements, then swaps them if necessary so that the larger of the two is the second number. Next, the second and third numbers are compared. The larger of those two are swapped, if necessary so that the larger of the two is the second number. The process continues until the largest number in the array is the last number in the array. Then the process is repeated until the array is sorted. A search algorithm that works with sorted data. The array is divided in half, searched in the correct half repeatedly, until the item is found An algorithm that divides an array in half repeatedly until all data is isolated. Then the isolated data is "merged" back together in correct order. The ASCII sort order for data. Try It/Solve It 1. Create an array of Strings that stores all the names of the students in your class. Sort it using one of the algorithms covered in this lesson. Do a binary search for your name in the sorted list and find out what index your name is at in the list of your classmates

Explanation / Answer

3-

A linear search scans one item at a time, without jumping to any item .

A binary search however, cut down your search to half as soon as you find middle of a sorted list.

Linear search also referred to as sequential search looks at each element in sequence from the start to see if the desired element is present in the data structure. When the amount of data is small, this search is fast.Its easy but work needed is in proportion to the amount of data to be searched.Doubling the number of elements will double the time to search if the desired element is not present.

Binary search is efficient for larger array. In this we check the middle element.If the value is bigger that what we are looking for, then look in the first half;otherwise,look in the second half. Repeat this until the desired item is found. The table must be sorted for binary search. It eliminates half the data at each iteration.Its logarithmic.

For other questions please provide as seprate question

Thanking you

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote