1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
NeX [460]
3 years ago
9

Reductor Array For two integer arrays, the comparator value is the total number of elements in the first array such that there e

xists no integer in the second array with an absolute difference less than or equal to d. Find the comparator value. For example there are two arrays a = [ 7,5, 9), b = 1 13, 1, 4), and the integer d = 3. The absolute difference of a[0] to b[0] = 17 - 13/= 6, b[1= 17-1 | = 6, and b[2] = 17-41= 3, to recap, the values are 6,6, 3. In this case, the absolute difference with b[2] is equal to d = 3, so this element does not meet the criterion. A similar analysis of a[1] = 5 yields absolute differences of 8, 4, 1 and of a[2] 9 yields 4, 8, 5. The only element of a that has an absolute difference with each element of b that is always greater than dis element a[2], thus the comparator value is 1. Function Description Complete the function comparatorValue in the editor below. The function must return an integer that denotes the comparator value of the arrays. comparatorValue has the following parameter(s): a[a[O),...a/n - 1]]: an array of integers b[b[0],...b[m - 1]]: an array of integers d: an integer
Computers and Technology
1 answer:
vlada-n [284]3 years ago
8 0

Answer:

The function in Python is as follows:

def comparatorValue(a,b, d):

   count = 0; test = 0;

   for i in a:

       for j in b:

           if abs (i - j) <= d:

               test+=1

       if test == 0:

           count+=1

       test = 0

   print(count)

Explanation:

This defines the function

def comparatorValue(a,b, d):

The initializes the count and test to 0

   count = 0; test = 0;

This iterates through a

   for i in a:

This iterates through b

       for j in b:

This calculates absolute difference of elements in a and b. The absolute is then compared to d.

If the calculated difference is less or equal to d, the value is not a comparator value (test in then incremented)

<em>            if abs (i - j) <= d: </em>

<em>                test+=1 </em>

The comparison ends here

If test is 0, then the value is a comparator value (count is incremented by 1)

  <em>     if test == 0: </em>

<em>            count+=1 </em>

Test is set to 0 for another iteration

<em>   </em>     test = 0

This prints count

   print(count)

You might be interested in
Who is the person responsible for creating the original website content?
Romashka [77]

Answer: D) Content creator

Explanation:

  • Content creator are responsible for creating the original content of the website. They contribute writing the blog posts about various topics and promote the content with the help of digital and social media.
  • Content creator are basically responsible for writing blog post on the industry based topics, graphic design and video editing.

Content editor uses data and evaluation from the users for analysis. It basically includes design and development to enhanced the material on the website.

Static and dynamic information are related to computer terminologies.

Therefore, (D) option is correct.

8 0
3 years ago
Define print_shape() to print the below shape. Example output:
ella [17]

The print_shape() is an illustration of Python function; whose execution is carried out when the function is called

<h3>The print_shape() function</h3>

The print_shape() function written in Python, where comments are used to explain each action is as follows:

#This defines the function

def print_shape():

   #The following iteration is repeated three times

   for i in range(3):

       #This prints the *** in each iteration

       print('***')

#This calls the function

print_shape()

Read more about Python functions at:

brainly.com/question/15745784

5 0
3 years ago
Write a function transpose(matrix) that returns the transpose of the input matrix, which is represented as a list of lists. Reca
mariarad [96]

Answer:you eat

Explanation:yea

4 0
3 years ago
When Clara accesses the programs and documents on her computer by way of icons, she is said to be employing
julsineya [31]
Your answer would be D, graphical user interface. Hope this helps!
5 0
4 years ago
Read 2 more answers
From the practice directory, you wish to capture a listing of files and directories to a file in your user2 directory, thus allo
MArishka [77]

Answer:

variable(s) determine the amount of potential energy an object has?

Explanation:

6 0
3 years ago
Other questions:
  • All of the following except one are issues that should be covered in an AUP. Which one is the exception?
    5·1 answer
  • The operations planning practice of inputting sales forecasts into computer software that accurately predicts the amount and tim
    6·1 answer
  • Which occupation requires certification by the state?
    15·2 answers
  • ____ software is rights-protection software used to control the use of a work.
    9·1 answer
  • There is an application which inputs hundred numbers from the user, if user enters a positive number it increments valid numbers
    6·1 answer
  • Processors for most mobile devices run at a slower speed than a processor in a desktop PC.
    9·2 answers
  • Which technology has the potential to be misused to make atomic bombs? A. computer technology B. nuclear technology C. medical t
    14·1 answer
  • A _____ is a number that summarizes an encrypted information. digital certificate hash function message digest hash algorithm
    8·1 answer
  • What is difference between base font and font tags​
    13·1 answer
  • 15. You read a news article that's politically biased and not well organized. It's
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!