Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer all question 10 pts) You are given two arrays of integers A and D, with A sorted in ascending order and D sorted

image text in transcribed

Please answer all question

10 pts) You are given two arrays of integers A and D, with A sorted in ascending order and D sorted in descending order. Consider the following algorithm for checking whether or not A and D have an element in common findCommonElement(A, D) : # assume that A is sorted in ascending order and D is sorted in d for i -0 to length(A)-1 escending order # iterate through A # iterate through D # check pairwise for j = 0 to length(D)-1 { if (A[i] -D[j]) { return TRUE } return FALSE (a) If arrays A and D have size n, what is the worst case running time of the procedure (b) For 4, describe input arrays A, Di that will be the best case, and arrays A2 (c) Write pseudocode for an algorithm that runs in (n) time for solving the problem. findCommonElement? Provide a bound. D2 that will be the worst case for findCommonElement. Your algorithm should use the fact that A and D are sorted arrays

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_2

Step: 3

blur-text-image_3

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 Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions