Reductor Array For two integer arrays, the comparator value is the total number of elements in the first array such that there exists 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

Answers

Answer 1

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)

           if abs (i - j) <= d:

               test+=1

The comparison ends here

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

      if test == 0:

           count+=1

Test is set to 0 for another iteration

      test = 0

This prints count

   print(count)


Related Questions

how to make an app according to peoples will

Answers

Answer:

Follow these steps to create your own app:

1)Choose your app name.

2)Select a color scheme.

3)Customize your app design.

4)Choose the right test device.

5)Install the app on your device.

6)Add the features you want (Key Section)

7)Test, test, and test before the launch.

8)Publish your app.

Explanation:

(!!_!!)

Assign sum_extra with the total extra credit received given list test_grades. Iterate through the list with for grade in test_grades:. The code uses the Python split() method to split a string at each space into a list of string values and the map() function to convert each string value to an integer. Full credit is 100, so anything over 100 is extra credit.Sample output for the given program with input: '101 83 107 90'Sum extra: 8(because 1 + 0 + 7 + 0 is 8)user_input = input()test_grades = list(map(int, user_input.split())) # test_grades is an integer list of test scoressum_extra = 0 # Initialize 0 before your loop''' Your solution goes here '''print('Sum extra:', sum_extra)

Answers

Answer:

Replace ''' Your solution goes here '''

With

for i in test_grades:

   if i > 100:

       sum_extra+=i - 100

Explanation:

This iterates through the list

for i in test_grades:

This checks for list elements greater than 100

   if i > 100:

The extra digits (above 100) are then added together

       sum_extra+=i - 100

Although it is not a term Excel uses, how do most people think of Excel?

Answers

Answer:

People think of Excel as a Spreadsheet.

Consider three strings instr1, instr2 and instr3 having only lowercase alphabets. Identity a string outstr, with the smallest possible length such that when strings instr1, outstr and instr2 are concatenated in the same order instr3 becomes a substring of the concatenated string. Print the smallest possible length of (instr1 + outstr - instr2) satisfying the given criteria. Note: The string outstr can also be an empty string Input Format: The first second and third line contain strings instr1instr2 and instr3 respectively. Read the input from the standard input stream. Output Format: Print the smallest possible length of (instr1 + outstr + instr2) satisfying the given criteria. Print the output to the standard output stream You're Explanati CIAR Sample Output Jusuen that when strings instr 1. outstr and instr2 are concatenated in the same order instr3 becomes a substring of the concatenated string. Print the smallest possible length of (instr. outstr - instr2) satisfying the given criteria

Answers

10 points is nothing to answer this junk just saying

The relation LIBRARY records books currently on loan to students. Each book has one ISBN_NO The library has several copies of each book. A student may borrow more than one book but may not borrow a book they have already checked out. Assume also that no two library members have the same name.
ISBN_NO STUDENT_NAME STUDENT_ADDRESS
01 Liu Phelps
02 Liu Phelps
02 Holmes Phelps
03 Lopez Hollister
LIBRARY
a) Is LIBRARY in 1NF?
b) Identify candidate key(s)
c) Identify functional dependencies
d) Explain why is LIBRARY not in 2NF?
e) Decompose LIBRARY to comply with 2NF rules.

Answers

I think the answer is E

Write a program that accepts inputs, outputs them and exits correctly when - 1
is pressed

Answers

Answer:

Explanation:

The following program is written in Python. It simply creates an endless loop that continously asks the user for an input. If the input is not -1 then it outputs the same input, otherwise it exists the program correctly. A test output can be seen in the attached image below.

while True:

   answer = input("Enter a value: ")  

   if answer != "-1":

       print(answer)

   else:

       break

Write an algorithm that accepts two numbers,
divide the first number by the second and display the
quotient

Answers

Let’s write the algorithm in the form of a pseudocode!

Pseudocode:Quotient_of_Two_Number
Declare: num1, num2, quotient
START
Display (Enter a number)
Read num1
Display (Enter a number)
Read num2
quotient = num1/num2
Print (“Quotient”)
STOP

Which effect is used in this image?

A.sepia effect

B.selective focus

C.zoom effect

D.soft focus

Answers

Answer:

A.sepia effect.

It is Selective focus!

When a sentinel is used in a (______/posttest) loop to validate data, the loop repeats as long as the input is (valid/______). pretest, invalidPress enter after select an option to check the answer posttest, invalidPress enter after select an option to check the answer pretest, validPress enter after select an option to check the answer posttest, valid

Answers

Answer:

When a sentinel is used in a (pretest/post test) loop to validate data, the loop repeats as long as the input is (valid/invalid).

Explanation:

Required

Fill in the gaps

Sentinel are used to validate or invalidate loops (pretest and post test loops).

Since , some parts of the brackets have aready been filled, we simply complete the blanks with the opposite of the term in the bracket. i.e. the opposite of post test is pretest and the opposite of valid is invalid.

So, the blanks will be filled with pretest and invalid.

in online education is intrinsically related to equity. Professionalism Communication Accessibility
a. professionalism
b. communication
c. Accessibility ​

Answers

Answer:

The correct answer is C. Accessibility.

Explanation:

Online education is understood as the educational system by which knowledge is acquired through the use of computer media in which students interact with teachers electronically without personally attending classes in person. This type of education has advantages and disadvantages: in terms of the pros, it is an education system that requires less time and mobility on the part of the student, thus facilitating the process of learning and making the times more effective, but in terms of its cons, online education is not always accessible, as in order to access it requires a certain connectivity capacity, that is, the provision of a computer and an internet network capable of guaranteeing the functioning of online educational systems.

In this context, accessibility is understood as the ability of each individual to acquire an online education through the use of the necessary means for this, so accessibility implies the possibility of accessing said electronic media. This is related to equity, as online education systems should be able to guarantee their use by means of equipment that is as less specific as possible so that any common person can access them.

Answer:

C. Accessibility ​

Explanation:

Intrinsic motivation is doing something for the sake of personal satisfaction.

For the following machine code expressed in hexadecimal, write the corresponding MIPS assembly instruction. Note: in case of branch or jump instructions, you should write the target address in hexadecimal notation in the MIPS assembly instruction. e.g., j 0x00000016.

Machine code:0x08100008
Assembly instruction:??

Answers

Answer:

Assembly instruction is j 0x00400020

Explanation:

j 0x00400020

EXPLAINATION-

GIVEN Machine Code = 0x 0 8 1 0 0 0 0 8

Step 1:

Now convert 0 8 1 0 0 0 0 8 Each digit to Binary

= 0000 1000 0001 0000 0000 0000 0000 1000

= 000010 00000100000000000000001000

000010 is opcode of j instruction

we are left with

0000 0100000000000000001000

Step 2:

Add two zeroes to right

0000 0100 0000 0000 0000 0010 0000

Step 3:

Remove 4 highest bit

0100 0000 0000 0000 0010 0000

Decimal of it is 4194336

Step 4:

Now convert it into Hexadecimal

we get 400020

So Assembly instruction is j 0x00400020

j 0x00400020

.......................................................................................................................................................................

a qbasic program to tranverse a binary tree




Answers

Explanation:

i don't know. ....

...;!

Devices which are used to receive data from central processing unit are classified as

Answers

Answer:

Input devices are used to receive data from central Processing Unit.

Explanation:


The keyboard shortcut to open the Help window is:
O F1
O F2
O F4
O F8

Answers

Answer:

F1 is the correct answer

You are the IT administrator for a small corporate network. The employee in Office 1 needs your assistance managing files and folders. Your task is to use the command prompt to complete the following:

a. Create the D:​\​utilities​\​recover directory. Use the md or mkdir command to create (make) a directory.
b. Delete the D:​\​software​\​arch98 directory and all of its files.
c. Use the rd command to delete (remove) a directory.
d. Use the /s switch to remove the directory and all of its contents at once.

Answers

Answer:

(a) mkdir /d D:\utilities\recover    

     or

    mkdir D:\utilities\recover    

(b) rd  /s  D:​\software​\arch98

Explanation:

(a) To make a new directory we use the md or mkdir command followed by the name of the directory as follows;

mkdir [name_of_directory]

The name of the directory could also be a relative or absolute path depending on the request.

In the task, the specified directory uses an absolute path given as D:​\​utilities​\​recover. This path is in a drive D. Therefore, if you are in another drive different than D, to run this command, it is a great idea to do that with the /d switch.

In summary:

i. if in drive D, to make a directory D:\utilities\recover, type the following command;

mkdir  D:\utilities\recover    

ii. if otherwise in a different drive, type the following command.

mkdir /d D:\utilities\recover

(b) To delete a directory, we use the rd or rmdir command. If the directory has contents that also need to be deleted, we use the switch /s alongside the rd or rmdir.

In the task given, the directory to be deleted is D:\software\arch98. This includes deleting all of its files too. To do this, type the following command;

rd /s D:\software\arch98

A calculator is not a computer because​

Answers

[tex]\huge\fbox\red{❥answer}[/tex]

By definition a computer is an electronic device used to store and compute data. So, by definition a calculator stores and interprets data/numbers, and that makes it a computer. However, a computer can also use programs, and manipulate stored data to complete those programs.

hope it helps!! :D

What is computer code?
A. Java Script
B. XML
C. HTML
D. Any programming language

Answers

Answer:

D

Explanation:

A new attack involves hacking into medical records and then offering these records for sale on the black market. A medical records company in Brazil learned of this attack and has built controls into its systems to prevent hackers from accessing its systems. This is an IT application of the COSO principle of _______ and evidences _______ controls.

Answers

Answer:

1. Control Activities

2. Internal

Explanation:

Considering the scenario explained in the question, it can be concluded that This is an IT application of the COSO principle of CONTROL ACTIVITIES and evidence PREVENTIVE controls.

In this case, the Control Activities which is one of the five principles of COSO (Committee of Sponsoring Organizations of the Treadway Commission) is a means of selecting and developing general control over technology, through strategies and techniques. This is what the medical records company did by building controls into its systems to prevent hackers from accessing its system.

This is an example of internal CONTROL ACTIVITIES that illustrates PREVENTIVE control against potential risks or hacks.

The use of Quick Styles is a great way to save
a. money
b. grades
C. time
d. files
Please select the best answer from the choices provided
Ο Α
B

Answers

I believe the best answer choice is A money.

Answer:

c

Explanation:

trust

a heart murmur is caused by incorrect operation of ________?​

Answers

Answer:

the valves

Explanation:

science explains your questions answer. also did you know that the queen was an engineer in WWII? you probably did but you need 20 characters to submit an answere trust me it is the valves.

One of the algorithms we covered this week is considered impractical for real-world use and is almost exclusively used only in the academic setting. This algorithm is

Answers

Answer:

Bubble sort

Explanation:

Bubble Sort is generally considered impractical for real-world use and is almost exclusively used only in the academic setting.

Bubble sort is often characterized by its iteration method, whereby it steps through a list repeatedly by performing the comparison and swapping near elements if the second element when is wrongfully positioned.

It is considered as a form of simple algorithm and sometimes referred to as sinking sort.

In reality, algorithm including the likes of quicksort, import, or merge sort is deemed efficient.

LAB: Divide input integers
Write a program using integers userNum and divNum as input, and output userNum divided by divNum three times. Note: End with a newline.
Ex: If the input is:
2000 2
the output is:
1000 500 250
Note: In Java, integer division discards fractions. Ex: 6 / 4 is 1 (the 0.5 is discarded).
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
/* Type your code here. */
}
}
(My professor wants us to use this temple and I'm not sure how I should start typing the code were it says "type code here". I've tried differnt forms like the one provided below but they all have errors according to the program. it tells me that i have to place ; .
import java.util.Scanner;
public class LabProgram {
public static void main(String[] args) {
userNum= int(input())
divNum= int(input())
# calculating the division three times
userNum=userNum//divNum
#i have used end=' ' so that it does not produce new line
# instead of that it produce space
print(userNum,end=' ')
userNum=userNum//divNum
print(userNum,end=' ')
userNum=userNum//divNum
print(userNum,end=' ')
}
}
Errors:
Program errors displayed here
LabProgram.java:5: error: '.class' expected userNum= int(input()) ^ LabProgram.java:5: error: ';' expected userNum= int(input()) ^ LabProgram.java:6: error: '.class' expected divNum= int(input()) ^ LabProgram.java:6: error: ';' expected divNum= int(input()) ^ LabProgram.java:7: error: illegal character: '#' # calculating the division three times ^ LabProgram.java:7: error: ';' expected # calculating the division three times ^ LabProgram.java:7: error: ';' expected # calculating the division three times ^ LabProgram.java:9: error: illegal character: '#' #i have used end=' ' so that it does not produce new line ^ LabProgram.java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram.java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram.java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram.java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram.java:9: error: ';' expected #i have used end=' ' so that it does not produce new line ^ LabProgram.java:10: error: illegal character: '#' # instead of that it produce space ^ LabProgram.java:10: error: ';' expected # instead of that it produce space ^ LabProgram.java:10: error: ';' expected # instead of that it produce space ^ LabProgram.java:10: error: ';' expected # instead of that it produce space ^ LabProgram.java:11: error: ';' expected print(userNum,end=' ') ^ LabProgram.java:12: error: ';' expected userNum=userNum//divNum ^ LabProgram.java:13: error: ';' expected print(userNum,end=' ') ^ LabProgram.java:14: error: ';' expected userNum=userNum//divNum ^ LabProgram.java:15: error: ';' expected print(userNum,end=' ') ^ 22 errors

Answers

Mark Brainliest please


Answer:
# The user is prompted to enter number as dividend
# The received number is assigned to userNum
userNum = int(input("Enter the number you want to divide: "))
# The user is prompted to enter number as divisor
# The divisor is assigned to x
x = int(input("Enter the number of times to divide: "))
# divideNumber function is defined to do the division
def divideNumber(userNum, x):
# counter is declared to control the loop
counter = 1
# the while-loop loop 3 times
# the division is done 3 times
while counter <= 3:
# integer division is done
# truncating the remainder part
userNum = userNum // x
# the result of the division is printed
print(userNum, end=" ")
# the counter is incremented
counter += 1
# the divideNumber function is called
# the received input is passed as parameter
# to the function
divideNumber(userNum, x)
# empty line is printed
print("\n")
Explanation:
The // operator in python works like the / operator in C. The // operator returns only the integer part of division operation. For instance 6 // 4 = 1. The fraction part is discarded

In the given code you include two languages, that's why it will give the error messages, and for better understanding, we give the program into two languages:

Following are the Java and Python Program to these questions:

Java Program:

import java.util.*;//import package

public class LabProgram  //defining a class LabProgram  

{

public static void main(String[] ar)//defining main method  

{

int userNum,divNum;//defining integer variable

Scanner on=new Scanner(System.in);//defining Scanner class Object for user-input

userNum=on.nextInt();//input value

divNum=on.nextInt();//input value

for(int i=0;i<3;i++)//defining loop to divide value 3 times

{

userNum=userNum/divNum;//dividing userNum by divNum and store its value into userNum

System.out.println(userNum);//print userNum value

}

}

}

Python Program:

userNum= int(input())#input integer value

divNum= int(input())#input integer value

# calculating the division three times

userNum=userNum//divNum#using userNum that divides userNum by divNum and store its value

print(userNum)#print userNum value

userNum=userNum//divNum#using userNum that divides userNum by divNum and store its value

print(userNum)#print userNum value

userNum=userNum//divNum#using userNum that divides userNum by divNum and store its value

print(userNum)#print userNum value

Output:

Please find the attached file.

Learn more:

brainly.com/question/21661364

A person's oral communication skills can give either a positive or negative first impression.

Answers

Answer:

true

Explanation:

oral communication can be awkward or good.

Sites like Zillow get input about house prices from a database and provide nice summaries for readers. Write a program with two inputs, current price and last month's price (both integers). Then, output a summary listing the price, the change since last month, and the estimated monthly mortgage computed as (currentPrice * 0.051) / 12 (Note: Output directly. Do not store in a variable.). Ex: If the input is: 200000 210000 the output is:
This house is $200000.
The change is $-10000 since last month.
The estimated monthly mortgage is $850.0.

Answers

Answer:

The program in Python is as follows:

currentPrice = int(input("Current: "))

lastMonth = int(input("Last Month: "))

print("The house is $",currentPrice)

print("The change is $",(currentPrice-lastMonth),"since last month")

print("The estimated monthly mortgage is $",(currentPrice * 0.051) / 12)

Explanation:

Get input for current price

currentPrice = int(input("Current: "))

Get input for last month price

lastMonth = int(input("Last Month: "))

Print current price

print("The house is $",currentPrice)

Print change since last month

print("The change is $",(currentPrice-lastMonth),"since last month")

Print mortgage

print("The estimated monthly mortgage is $",(currentPrice * 0.051) / 12)

Which of the examples is part of client-side code?
A.
update bank account balance
B.
prompt for special characters in user name
C.
navigate to a different website
D.
delete an online social networking account
E.
shop for books online

Answers

Answer:

I think it is A(update bank account balance)

not really sure

Answer:

B.

Explanation:

javascript or python's input code is a client sided code

In a void function, the return statement is not necessarily. True or false? ​

Answers

Answer:

true

Explanation:

Answer:

True

Explanation:

In a void function, who the name says,  void = empty, you dont need to return any result.

A company hires some temporary workers. On day one, the temporary employees report they are unable to connect to the network. A network technician uses a packet analysis tool and finds that many clients are continuously sending out requests for an IP address, but many of them are not receiving a response. Which of the following could be the cause of this issue?
A. Exhausted DHCP scope.
B. Untrusted SSL certificates.
C. Duplicate MAC addresses.
D. Incorrect firewall settings.

Answers

Answer:

A. Exhausted DHCP scope.

Explanation:

The company has many temporary workers, and permanent workers. There are many people under one network. Since, there are many workers, there can't be untrusted SSL certificates. They all have different devices or computers, so they can't both have duplicate MAC addresses. Lastly, the firewall is supposed to protect against computer viruses and other types of malware, not to harm the user and scope. So, the answer is A.

DR JAVA
Write a program that includes the following while loops.
Input radius (double) values and prints the diameter, circumference, and area of a circle. The loop will stop executing when a 0 or negative value is entered. Declare a global constant for PI, where PI = 3.14159265. Be sure and echo the input and display all output to 3 decimal places.
a second while loop that works as above, but instead asks the user if they want to enter radius (Y/N). What happens if you enter a negative radius?
Input temperatures until 999 and print whether above or below freezing.
Input temperatures until 999 and count number above and below freezing.
Input temperatures until 999 and print the average temperature.
Ask user if they want to enter a temperature and print whether above or below freezing.
a while loop that repeatedly enters test scores (integer) (pick a sentinel) and counts the numbers of As, Bs, Cs, Ds, and Fs and also prints the average test score.

Answers

Answer:

Explanation:

The following code is all written in Java. It is a very long program that contains methods for all of the requested while loops in the question. Each one is called inside the main method itself. A part of the output is shown in the attached picture below due to the output being so long. Due to technical difficulties, I have attached the code as a txt file below.

Select which is true for for loop​

Answers

Answer:

i dont understand what you mean and what you are asking in the qestion

Explanation:

explain why you can determine machine epsilon on a computer using IEEE double precision and the IEEE Rounding to Nearest Rule by calculating (7/3 - 4/3) - 1

Answers

Answer:

I think this is the answer

Explanation:

so if it is not right use it as an exsample

Other Questions
What is the value of x in the figure?(4x + 2) 150 A. 37B. 60C. 160D. 237 2/3 - 1/2I am silly sorry could someone help? In which sentence from King's I Have a Dream Speech does the author acknowledge those who disagree with his main argument that followers must set high expectations to succeed in their struggle for equality?Click here to read the speech.I am not unmindful that some of you have come here out of great trials and tribulations.Those who hope that the Negro needed to blow off steam and will now be content will have a rude awakening if the nation returns to business as usual.one day, down in Alabama, with its vicious racists, with its governor having his lips dripping with the words of interposition and nullificationThere are those who are asking the devotees of civil rights, When will you be satisfied?' what is environmental BRAINIEST AND 15 POINTS HELP FAST!!!In the square below, the two semi-circles are congruent. Find the area of theshaded region. If necessary, round your answer to two decimal places. I need to know how to solve this anyone? PLSSS HELP ME I DONT HAVE MUCH TIME What is the slope of the line? Hint: Note the scales for the x and y axis.What is the y - intercept of the line?What is the equation of the line? y = x + Use the equation to predict the number of visits per week to a coffee shop that is 3 blocks away. How would you explain the proper use of distributive property ? When the resistance attacks, would you rather join the children asEliezer does or join in the fighting? Slope and equation, how much battery does she lose an hour 8.Which of the following is NOT a recommended guideline for practicing positivethinking?a.Establish a way of dealing with your fears.b.Concentrate on what is going poorly in your life so that you can fix it.C.Separate irrational fears from ones to which you need to pay attention.D.Hold yourself accountable for efforts, not results. Solve for a r=x(a+b)Solve for x x/2=-7 There Are many indoor hobbies you can try they can be active such as squash or something you can do sitting down like painting interested pick a hobby that suits you and see how far you can take it good luck The rate of this reaction is markedly increased if a small amount of sodium iodide is added to the reaction mixture. The sodium iodide is not consumed by the reaction and is therefore considered to be a catalyst. Explain how the presence of iodide can speed up the rate of the reaction. Anyone need a free tutor? For English The dolphin is 20 feet below the serface of the ocean. A 2-gallon jug of water costs $8.24. What is the price per quart? Electricity in the Industrial Revolution. Answer following questions for 20 points.1.) What did it do?2.) How did it change things?3.) Why was it so important? Power lines carry _____ energy in the form of electricity.