You, Alice and Bob are working on recursive search algorithms and have been studying a variant of binary search called trinary search. Alice has created the following pseudocode for this algorithm: TSearch (A[a...b], t) If a b return -1 Let pl = a + Floor ((b-a)/3) If A[p1] = t return p1 If A[p1] > t return TSearch (A[a...p1-1], t) Let p2= a + Ceiling (2(ba)/3) If A[p2] = t return p2 If A[p2] > t return TSearch (A [p1+1...p2-1],t) Return TSearch (A [p2+1...b],t) EndTSearch

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please show and explain so I can understand.

You, Alice and Bob are working on recursive search algorithms and have been studying a
variant of binary search called trinary search. Alice has created the following pseudocode
for this algorithm:
TSearch (A[a...b], t)
If a b return -1
Let p1= a + Floor ((b-a)/3)
If A [p1] = t return pl
If A[p1] > t return TSearch (A[a...p1-1],t)
Let p2= a + Ceiling (2(b - a)/3)
If A[p2]t return p2
If A[p2] > t return TSearch (A [p1+1...p2-1],t)
Return TSearch (A [p2+1...b],t)
EndTSearch
Transcribed Image Text:You, Alice and Bob are working on recursive search algorithms and have been studying a variant of binary search called trinary search. Alice has created the following pseudocode for this algorithm: TSearch (A[a...b], t) If a b return -1 Let p1= a + Floor ((b-a)/3) If A [p1] = t return pl If A[p1] > t return TSearch (A[a...p1-1],t) Let p2= a + Ceiling (2(b - a)/3) If A[p2]t return p2 If A[p2] > t return TSearch (A [p1+1...p2-1],t) Return TSearch (A [p2+1...b],t) EndTSearch
b) Bob has heard that trinary search is no more efficient than binary search when
considering asymptotic growth. Help prove him correct by using induction to show
that your recurrence relation is in (log₂ n) as well.
i. Split the tight bound into and upper (big-O) and lower (big-N).
ii. For each bound select a function from e(log₂ n) to use in your proof, like
alog₂ n or alog₂ n-b. Remember there are typically multiple ways to prove
the theorem using different choices of functions.
iii. Use induction to prove your bound. Include all parts of the proof including
base case, inductive hypothesis and inductive case. Be as precise as possible
with your language and your math. Remember it's possible to get stuck at this
point if you have selected the wrong function in the last step.
Transcribed Image Text:b) Bob has heard that trinary search is no more efficient than binary search when considering asymptotic growth. Help prove him correct by using induction to show that your recurrence relation is in (log₂ n) as well. i. Split the tight bound into and upper (big-O) and lower (big-N). ii. For each bound select a function from e(log₂ n) to use in your proof, like alog₂ n or alog₂ n-b. Remember there are typically multiple ways to prove the theorem using different choices of functions. iii. Use induction to prove your bound. Include all parts of the proof including base case, inductive hypothesis and inductive case. Be as precise as possible with your language and your math. Remember it's possible to get stuck at this point if you have selected the wrong function in the last step.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Merge Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education