Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Below are how the arrays are represented ARRAY1[ ]=[1,5,6,6,9,9,9,11,11,21]. Here length of ARRAY1 is m. ARRAY2[] =[6,6,9,11,21,21,21]. Here length of ARRAY2 is n. Array to

image text in transcribedimage text in transcribedimage text in transcribed

Below are how the arrays are represented ARRAY1[ ]=[1,5,6,6,9,9,9,11,11,21]. Here length of ARRAY1 is m. ARRAY2[] =[6,6,9,11,21,21,21]. Here length of ARRAY2 is n. Array to be returned would be ARRAY []=[6,9,11,21]. ATTN: Please be reminded that you cannot use library functions to do any of the tasks required above. Doing so would straight up result in a score of Zero! (2) [40 points] In a separate implementation, code up a solution in such a way that your solution solves the problem with O(nlog(m)) time complexity or O(mlog(n)) time complexity. Here log means to the base of 2. I'm sure you already know that the hint is to use Binary Search. Context and Problem Statement: A web search engine returns you a list of web-links that match the set of words in your query. Each web-link is assigned an integer for identification purposes(page-ID) This is done by maintaining an "inverted index". An inverted index, at a very elementary level, is a mapping that takes a word and returns to you a list of web-links which contains the word. That list would be a sorted(ranked) array of page-IDs where the web-link with the highest rank for the query is displayed on top. When your query to the web search engine contains multiple words, the search engine needs to find the sorted array for each word and then computes the intersection of these arrays. Given the number of webpages existing in the world-wide-web, this work is very computationally challenging! In this assignment you are required to write programs which takes as input two sorted arrays and returns a new array containing the elements found in both the sorted arrays. It is alright if the input arrays have duplicates, but the returned array should be duplicate free

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions