Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose company X has hired you as a software engineer. Company X is desperate to improve the run time of their software. Rather than allow

image text in transcribed
Suppose company X has hired you as a software engineer. Company X is desperate to improve the run time of their software. Rather than allow you to use the standard binary search algorithm, company X demands you create a new version. Since recursively dividing the array into two parts is so efficient for searching, the bigwigs at company X conclude dividing the array into three parts will be even more efficient. This new 3-ary" search divides the given sorted array into 3 equal sized sorted subarrays. It finds which subarray will contain the given value and then recursively searches that subarray. If the given value is in the array you should return true. Otherwise you should return false. (1) (3 points) Write up this new recursive algorithm using pseudocode. (Hint: For simplicity you can assume the number of elements in the given sorted array, n, is a power of 3) (2) (2 point) Create a recurrence to represent the worst case run time of our new 3-ary" search from the pseudocode. (Hint: The worst case run time occurs when the given value is not in the array) (3) (3 points) Use master theorem to solve your above recurrence relation. (4) (2 point) Compare this asymptotic run time to that of binary search. Does our new algorithm perform significantly better than binary search

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Intelligent Databases Technologies And Applications

Authors: Zongmin Ma

1st Edition

1599041219, 978-1599041216

More Books

Students also viewed these Databases questions

Question

29. What is the mean life span of an olfactory receptor?

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago