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

PLEASE ANSWER THE VOCABULARY PART AS WELL AS QUESITONS FROM 1 TO 4! Lesson Objec

ID: 3850509 • Letter: P

Question

PLEASE ANSWER THE VOCABULARY PART AS WELL AS QUESITONS FROM 1 TO 4!

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.


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.
2. Complete the following table using O notation. Under the notes section describe which would on average perform
the best?


3. Describe the difference between a linear and a binary search.
4. Explain how sorting order is determined if the data contains strings and numbers

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.

Explanation / Answer

vocabulary word Answers ---->

1) 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.

ans : Sequential Search

sequential search works on sorted as well as unsorted array.

2) 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.

ans : Selection Sort

3) 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.

ans : Bubble Sort ...... works in passes and swaps

4) 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.

ans : Binary Search Algorithm.

5) The ASCII sort order for data.

ans : HexSort

-----------------------------------------------------------------

1) Sort array of strings :

------------------------------------------------------------------   

2)

------------------------------------------------------------

3)

1) works on sorted as well as non-sorted input.

Sort_name Time Swaps adaptive ? stable ? Bubble O(n) to O(n^2) O(n^2) yes yes selection O(n^2) O(n) no no Merge O(nlogn) O(nlgn) no yes
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