= 1. (a) (6%) Let A[1..n] and B(1..m] be two arrays, each represents a set of numbers. Give an algorithm that returns an

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

= 1. (a) (6%) Let A[1..n] and B(1..m] be two arrays, each represents a set of numbers. Give an algorithm that returns an

Post by answerhappygod »

1 A 6 Let A 1 N And B 1 M Be Two Arrays Each Represents A Set Of Numbers Give An Algorithm That Returns An 1
1 A 6 Let A 1 N And B 1 M Be Two Arrays Each Represents A Set Of Numbers Give An Algorithm That Returns An 1 (119.64 KiB) Viewed 20 times
= 1. (a) (6%) Let A[1..n] and B(1..m] be two arrays, each represents a set of numbers. Give an algorithm that returns an array C[] such that C contains the intersection of the two sets of numbers represented by A and B. Give the time complexity of your algorithm in Big-o. As an example, if A = [6,9, 2, 1,0, 7] and B = (9, 7, 11, 4, 8,5,6, 0], then C should contain (9,7,6, 0] (the ordering of the numbers in array C does not matter). (b) (6%) Let A[1..n] be an array of n numbers. Each number could appear multiple times in array A. A mode of array A is a number that appears the most frequently in A. Give an algorithm that returns a mode of A. (In case there are more than one mode in A, your algorithm only needs to return one of them.) Give the time complexity of your algorithm in Big-0. As an example, if A = [9, 2, 7, 7, 1, 3, 2, 9, 7, 0,8, 1], then mode of A is 7.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply