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
What is the correct order for writing the 3 dimensions for a 3D object? Here are the 3 dimensions:
Nady [450]

Answer:

Length x Width x Hight

Explanation:

3 0
3 years ago
What is the best way to move up and down on a computer screen
Misha Larkins [42]

Answer: 1. Using your mouse or laptop trackpad, move your cursor to the scroll bar.

2. Then click and hold your mouse; you can now move the scroll bar up and down.

3. Release the mouse button once you reach the place on your screen you would like to go.

4 0
3 years ago
Why OSI is called open system?
MAXImum [283]

Answer: OSI system is called Open System Interconnection because It provides the collection of protocols for the connection of different system to connect with  any dependence on any other system or network.

Explanation: Open system interconnection establishes a connection between the different system for the communication purpose using several protocols and software standards .It has no dependency or any network or other system to do the functioning and works using the seven layers of the OSI architecture.Thus, that is why OSI system known as open system.

7 0
4 years ago
technical processor used in translate of instruction programs into single easy form for the computer to execute​
faltersainse [42]

Answer: The process of translation instructions expressed in a higher-level language into machine instructions (sometimes translating into Assembly language as an intermediate step) is called compilation, using a tool called a Compiler.

Explanation:

8 0
3 years ago
In which of the following situations would you want to use GOMS/KLM as an evaluation tool?
Elan Coil [88]

Answer:

B. Amazon's create an account process

Explanation:

The Keystroke-Level Model (KLM) is a cognitive modeling tool which can be used in predicting the performances carried out by human on interface designs. It's the most "practical" of the GOMS methodologies.

This model tends to predict how long it will take for the completion of a routine task by an expert user. There should be no errors.

So, Option B is correct because GOMS/KLM is an evaluation tool which fits in the evaluation of Amazon's create an account process.

7 0
3 years ago
Other questions:
  • Which connector is most commonly used to connect printers to desktop pc systems?
    10·1 answer
  • What are chemical manufacturers required to provide to anyone who purchases or uses their chemicals for a work purpose? Select a
    8·2 answers
  • What does the regular expression [a-z0-9\-] mean?
    8·1 answer
  • A cost-benefit analysis is intended to increase the likelihood that a support analyst has considered the major advantages and di
    5·1 answer
  • An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
    14·1 answer
  • What is the first step necessary to begin setting up a website once a host has been selected and paid?
    11·1 answer
  • What differentiates Accenture's Intelligent Platform Services (IPS) when our clients are making a decision to partner with a ser
    13·1 answer
  • What is the most popular type or method of guaranteed reservation where booking transactions will be charged automatically?
    7·1 answer
  • Every time attribute A appears, it is matched with the same value of attribute B, but not the same value of attribute C. Therefo
    11·1 answer
  • Sean is studying at a friend's house and notices that he can connect to the wireless network without entering a wireless network
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!