Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3: Explanation Example: Two pairs (e, f) and (g, h) are said to be symmetric if g is equal to f and e is

image text in transcribedQuestion 3: Explanation

Example: Two pairs (e, f) and (g, h) are said to be symmetric if g is equal to f and e is equal to h. For example, (10, 20) and (20, 10) are symmetric. Given an array of pairs find all symmetric pairs in it.

Input: arr[] = {{12, 21}, {31, 41}, {6, 11}, {41, 31}, {11, 6}}

Output: Following pairs have symmetric pairs

(31, 41)

(6, 11)

Q 3. (5 marks) Let A be an array contains n pair of integer values. Let two pairs (e, f) and (g, h) are symmetric if 9 is equals to f and h is equals to e. Write pseudocode for an algorithm that decides whether a given pair of input array A of size n is symmetric. If pair in A is symmetric the algorithm must return the value true, otherwise it must return the value false. 0 30 1 10 0 5 1 15 0 10 1 30 0 18 1 33 0 15 1 30 0 33 1 18 (a) Algorithm must return false if a single pair does not hold symmetric relation with any other pair in an array A. Suppose (x, y) is non-symmetric then the algorithm will return -1 or false. (1 mark) Explain what the worst case for the algorithm is. (4 marks) Compute the time complexity of the algorithm in the best case. You must give the order of the time complexity using big-Oh notation and you must explain how you computed the time complexity. (b)

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago

Question

Assessment of skills and interests.

Answered: 1 week ago

Question

Psychological, financial, and career counseling.

Answered: 1 week ago