Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (a) Precisely specify the conditions under which the following algorithm returns True, and then discuss, in detail, the running time of the algorithm. If

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

1. (a) Precisely specify the conditions under which the following algorithm returns True, and then discuss, in detail, the running time of the algorithm. If you think it has different best- and worst-case running times then these should be considered separately, and you should explain the conditions under which best and worst-cases arise. You must fully explain your answer and use 0, N and O appropriately to receive full marks. Algorithm Ex1 ((an, ... an),(61, ...,bm)) kan xm for it + 1 to n do for j 0 [10 marks] (b) Precisely specify the conditions under which the following algorithm returns True, and then discuss, in detail, the running time of the algorithm. If you think it has different best- and worst-case running times then these should be considered separately, and you should explain the conditions under which best and worst-cases arise. You must fully explain your answer and use 0, 12 and 0 appropriately to receive full marks. En Algorithm Ex2 ((an, ... an), (b1, ..., bn)) qe true for i+ 1 to n do j while j > 0 and q == true do If ai! = b; q+ false juj-1 return a 2 (c) Precisely specify the conditions under which the following algorithm returns True, and then discuss, in detail, the running time of the algorithm. If you think it has different best- and worst-case running times then these should be considered separately, and you should explain the conditions under which best and worst-cases arise. You must fully explain your answer and use 0, 12 and 0 appropriately to receive full marks. Algorithm Ex3 (T,c) T is a balanced binary search tree containing integer number values and c is an integer. Each node in T has two child nodes, either a numeric value or the value null to indicate the lack of a child value. node -root(T) found + false == == while (node! = null) and (found false) if node, value found + true else if c

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

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

4-16. We dont make refunds on returned merchandise that is soiled.

Answered: 1 week ago

Question

1. Identify three approaches to culture.

Answered: 1 week ago

Question

LO6 Describe how individual pay rates are set.

Answered: 1 week ago