Question

Asked Oct 11, 2019

106 views

Design a reasonably efficient algorithm for solving each of the following problems and determine its efficiency class.

a. You are given n telephone bills and m checks sent to pay the bills (n ≥ m).

Assuming that telephone numbers are written on the checks, find out who failed to pay. (For simplicity, you may also assume that only one check is written for a particular bill and that it covers the bill in full.)

**Algorithm to find who failed to pay telephone bill**

For finding who failed to pay telephone bill, first the bills and check arrays should be sorted. Then merge-like scan of these two sorted arrays is done by comparing telephone bills and telephone numbers that are written on the checks. So the detailed algorithm consists of the following steps.

Step 1: First sort bills and checks.

Step 2 : Do merge-like scan of these two sorted lists. Compare telephone numbers bi and cj and the number written on the check.

if (bi < cj) do

add bi to the list of unpaid telephone numbers

&nb...

Tagged in

Find answers to questions asked by student like you

Show more Q&A

Q: program6_2.pyNow write another program that reads her inventory file, displays all data for each ite...

A: A Python program that reads inventory file, and displays all the data for each item, and reports on ...

Q: I am getting stuck on the code to see if its a factor or not. Im not sure where I went wrong.

A: The following is the source code which prints whether a number is a factor of generated random numbe...

Q: I am changing careers and avoided math my entire academic life. Can you please tell me what math is ...

A: Importance of math in web development:For beginners, both arithmetic and basic algebra should be min...

Q: Using the table structures you created (in first attachment called "Table Stucture", remove all tran...

A: Click to see the answer

Q: Given three int variables that have been given values, areaCode, exchange, and lastFour, write a str...

A: As you have not specified the programming language, we are solving this question using C++ programmi...

Q: what is a future embedded computer mean?

A: Embedded computersAn embedded computer is a computer that is designed to do a specific task. An embe...

Q: PLEASE EXPLAIN ALL STEPSCreate a truth table of the equation:((((Y AND (NOT Z)) OR ((NOT Y) AND Z)) ...

A: Note: In the given equation, the number of opening and closing brackets is not equal. The following ...

Q: I am trying to write a java code to see if the number entered by the user is a factor of the random ...

A: The following source code will print whether a number is a factor of generated random number or not ...

Q: The category of operating system used for handheld devices.

A: Handheld DevicesA handheld device is an electronic or a computing device that can be carried in our...