Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My roommate has bought a pair of rabbits, Rowena and Salazar. We kept track of the number of offsprings every month in vector, r. We

My roommate has bought a pair of rabbits, Rowena and Salazar. We kept track of the number of offsprings every month in vector, r. We want to write an algorithm to find if given a number, q N, is in r. For instance, given the following sets, elements of q1 exist in r, whereas elements of q2 do not.

r = {1, 2, 3, 5, 8, 13, 21, 34} q1 = {2, 21, 34}

q2 = {5, 15, 35}

Write a recursive algorithm to solve the problem given above for any ordered set that uses the design technique discussed in class. If the query is found, return its index, otherwise, return 1. Your algorithm will be called using:

findFluffy( r, 0, r.length, query)

findFluffy(r, min, max, query) {

}

Calculate the time complexity of your approach.

T(n) =

(n) =

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago