Question

Problem 2. (5 pts.) Algorithms A and B perform the same task. On input of size...

Problem 2. (5 pts.) Algorithms A and B perform the same task. On input of size n, algorithm A executes 10 n 2 steps, and algorithm B executes 100,000 steps. Find the value of n above which algorithm B is more efficient. Show your work.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

For input of size n, the algorithm A executes

10n steps.

For input of size n, the algorithm B executes

100000 steps.

So,for algorithm B to be more efficient then A,

100000>10n^2

n^2<10000

n<100

So,

n\varepsilon (1,100)

Add a comment
Know the answer?
Add Answer to:
Problem 2. (5 pts.) Algorithms A and B perform the same task. On input of size...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Algorithms A and B perform the same task. On input of size n, algorithm A executes...

    Algorithms A and B perform the same task. On input of size n, algorithm A executes 0.003n2 instructions, and algorithm B executes 243n instructions. Find the approximate value of n above which algorithm B is more efficient. (You may use a calculator or spreadsheet.)

  • Consider four algorithms for doing the same task with exact running times of n log2 n,...

    Consider four algorithms for doing the same task with exact running times of n log2 n, n 2 , n 3 , and 2n (the algorithms take n log2 n, n 2 , n 3 , and 2n operations to solve the problem), respectively, and a computer that can perform 10^10 operations per second. Determine the largest input size n that can be processed on the computer by each algorithm in one hour.

  • 11. (12 marks 4x 3 marks) Consider four algorithms for doing the same task with exact...

    11. (12 marks 4x 3 marks) Consider four algorithms for doing the same task with exact running times of n log2 n, n', », and 2n, respectively, and a computer that can perform 1010 operations per second. Determine the largest input size n that can be processed on the computer by each algorithm in one hour

  • Q4) [5 points] Consider the following two algorithms: ALGORITHM 1 Bin Rec(n) //Input: A positive decimal...

    Q4) [5 points] Consider the following two algorithms: ALGORITHM 1 Bin Rec(n) //Input: A positive decimal integer n llOutput: The number of binary digits in "'s binary representation if n1 return 1 else return BinRec(ln/2)) +1 ALGORITHM 2 Binary(n) tive decimal integer nt io 's binary representation //Output: The number of binary digits in i's binary representation count ←1 while n >1 do count ← count + 1 return count a. Analyze the two algorithms and find the efficiency for...

  • Assume you have the choice of two algorithms for the same problem, (a) One that reduces a problem...

    algorithms Assume you have the choice of two algorithms for the same problem, (a) One that reduces a problem of size n in O(n) time to two sub-problems of size in, or (b ) One that solves the problem without any recursion in time O(n2) Which algorithm is faster? Show that if f(n) f(½n) + O(log(n)), then f(n) = O((log n) 4. Write code for a function that takes a nonempty search tree of the form discussed in the class,...

  • Find and explain an example of some programming processing task that demonstrates one of the common...

    Find and explain an example of some programming processing task that demonstrates one of the common growth rate functions. For example, the constant time function describes a task in which the work steps are the same regardless of the amount of input. The linear time function describes a task in which the work steps grow just as much as the input size does ('1 for 1'). The quadratic time function describes a task in which the work steps grow by...

  • 1 - [30 pts] Scheduling Algorithms Comparison Assume that we have 5 independent and aperiodic tasks...

    1 - [30 pts] Scheduling Algorithms Comparison Assume that we have 5 independent and aperiodic tasks (T1, ... , Ts) and they arrive to the system at times indicated below. Each task will run for the amount of execution time listed and is assigned a priority ranging from 0 (highest) to 10 (lowest), i.e. lower value means higher priority. There are no other tasks scheduled to arrive to the system until T1, ... , Ts complete. Task Arrival Time Execution...

  • 1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You...

    1. Suppose you are given 3 algorithms A1, A2 and A3 solving the same problem. You know that in the worst case the running times are Ti(n) = 101#nº + n, Ta(n) = 10”, TS(n) = 101 nº logo n10 (a) Which algorithm is the fastest for very large inputs? Which algorithm is the slowest for very large inputs? (Justify your answer.) (b) For which problem sizes is Al the best algorithm to use (out of the three)? Answer the...

  • Could you please help me to solve the problem. Also, could you please answer questions in...

    Could you please help me to solve the problem. Also, could you please answer questions in clear hand-writing and show me the full process, thank you (Sometimes I get the answer which was difficult to read).Thanks a lot Suppose we are comparing implementations of two algorithms on the same machine. For input size of n, Algorithm A runs in 8n^2 steps, while Algorithm B runs in 64nlog2(n) steps. For what value n>2, where n is an integer, does Algorithm A...

  • 5) (10 pts) Greedy Algorithms The 0-1 Knapsack problem is as follows: you are given a...

    5) (10 pts) Greedy Algorithms The 0-1 Knapsack problem is as follows: you are given a list of items, each item has an integer weight and integer value. The goal of the problem is to choose a subset of the items which have a sum of weights less than or equal to a given W with a maximal sum of values. For example, if we had the following five items (each in the form (weight, value)): 11(6, 13), 2(4, 10),...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT