Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Jump search is a searching algorithm that skips some items of a sorted array in place of searching all the items. Let n be the

Jump search is a searching algorithm that skips some items of a sorted array in
place of searching all the items. Let n be the number of items in a given array; the
optimal size k of jump is given by n2.
For instance, consider the array 0,2,5,6,8,9,12,15,16; in this case, n=9 and
k=3. When we search 15 in the given array using jump search algorithm, we jump
3 times (5916), and do linear search for 2 items (1215); thus, the total
number of comparisons is 3+2=5. Similarly, when we search 10, we jump 3 times
(5916), and do linear search for 1 item (12); thus, the total number of
comparisons is 3+1=4. Now, answer the following questions.
What is the average number of comparisons when you use jump search
algorithm for the given array? Assume that you search a random integer between
1 and 9.[10 points]
1,2,3,4,5,6,7,8,9
What is the average number of comparisons when you use jump search
algorithm for the given array? Assume that you search a random integer between
1 and 17.[10 points]
1,3,5,7,9,11,13,15,17
There is a solution i chegg. But I don't think it's right. Clarify the num for comparisons of each number. Is num of comparison at (1) for 1 is 1 or 2?
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions