Computer Science: An Overview (12th Edition)
12th Edition
ISBN: 9780133760064
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 12.5, Problem 2QE
Program Plan Intro
Complexity of problems:
Whether the practical solution of any solvable problem is complex or not is investigated by the solvability of problems. Some problems that are theoretically solvable are so complex means from a practical point of view they are unsolvable called as complexity of problems.
The step by step instructions that are written in an organized manner to solve a problem in computer science is called algorithm.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
suppose that n is not 2i for any integer i. How would we change the algorithm so that it handles the case when n is odd? I have two solutions: one that modifies the recursive algorithm directly, and one that combines the iterative algorithm and the recursive algorithm. You only need to do one of the two (as long as it works and does not increase the BigOh of the running time.)
A certain recursive algorithm takes an input list of n elements. Divides the list into Vn
sub-lists, each with yn elements. Recursively solves each of these yn smaller sub-
instances. Then spends an additional 0(n) time to combine the solutions of these sub-
instances to obtain the solution of the main instance.
As a base case, if the size of the input list is at most a specified positive constant, then
the algorithm solves such a small instance directly in 0(1) time.
a) Express the recurrence relation that governs T(n), the time complexity of this
algorithm.
b) Derive the solution to this recurrence relation: T(n) = 0(?).
Mention which methods you used to derive your solution.
Question 4: The function T(n) is recursively defined as follows:
1
if n = 1,
고 +. T(n -1) if n> 2.
Prove that T(n) = 0(n log n).
Chapter 12 Solutions
Computer Science: An Overview (12th Edition)
Ch. 12.1 - Prob. 1QECh. 12.1 - Prob. 2QECh. 12.1 - Prob. 3QECh. 12.1 - Prob. 4QECh. 12.2 - Prob. 1QECh. 12.2 - Prob. 2QECh. 12.2 - Prob. 3QECh. 12.2 - Prob. 4QECh. 12.2 - Prob. 5QECh. 12.3 - Prob. 1QE
Ch. 12.3 - Prob. 3QECh. 12.3 - Prob. 5QECh. 12.3 - Prob. 6QECh. 12.4 - Prob. 1QECh. 12.4 - Prob. 2QECh. 12.4 - Prob. 3QECh. 12.5 - Prob. 1QECh. 12.5 - Prob. 2QECh. 12.5 - Prob. 4QECh. 12.5 - Prob. 5QECh. 12.6 - Prob. 1QECh. 12.6 - Prob. 2QECh. 12.6 - Prob. 3QECh. 12.6 - Prob. 4QECh. 12 - Prob. 1CRPCh. 12 - Prob. 2CRPCh. 12 - Prob. 3CRPCh. 12 - In each of the following cases, write a program...Ch. 12 - Prob. 5CRPCh. 12 - Describe the function computed by the following...Ch. 12 - Describe the function computed by the following...Ch. 12 - Write a Bare Bones program that computes the...Ch. 12 - Prob. 9CRPCh. 12 - In this chapter we saw how the statement copy...Ch. 12 - Prob. 11CRPCh. 12 - Prob. 12CRPCh. 12 - Prob. 13CRPCh. 12 - Prob. 14CRPCh. 12 - Prob. 15CRPCh. 12 - Prob. 16CRPCh. 12 - Prob. 17CRPCh. 12 - Prob. 18CRPCh. 12 - Prob. 19CRPCh. 12 - Analyze the validity of the following pair of...Ch. 12 - Analyze the validity of the statement The cook on...Ch. 12 - Suppose you were in a country where each person...Ch. 12 - Prob. 23CRPCh. 12 - Prob. 24CRPCh. 12 - Suppose you needed to find out if anyone in a...Ch. 12 - Prob. 26CRPCh. 12 - Prob. 27CRPCh. 12 - Prob. 28CRPCh. 12 - Prob. 29CRPCh. 12 - Prob. 30CRPCh. 12 - Prob. 31CRPCh. 12 - Suppose a lottery is based on correctly picking...Ch. 12 - Is the following algorithm deterministic? Explain...Ch. 12 - Prob. 34CRPCh. 12 - Prob. 35CRPCh. 12 - Does the following algorithm have a polynomial or...Ch. 12 - Prob. 37CRPCh. 12 - Summarize the distinction between stating that a...Ch. 12 - Prob. 39CRPCh. 12 - Prob. 40CRPCh. 12 - Prob. 41CRPCh. 12 - Prob. 42CRPCh. 12 - Prob. 43CRPCh. 12 - Prob. 44CRPCh. 12 - Prob. 46CRPCh. 12 - Prob. 48CRPCh. 12 - Prob. 49CRPCh. 12 - Prob. 50CRPCh. 12 - Prob. 51CRPCh. 12 - Prob. 52CRPCh. 12 - Prob. 1SICh. 12 - Prob. 2SICh. 12 - Prob. 3SICh. 12 - Prob. 4SICh. 12 - Prob. 5SICh. 12 - Prob. 6SICh. 12 - Prob. 7SICh. 12 - Prob. 8SI
Knowledge Booster
Similar questions
- for ( i = 1 ; i < n ; i * 2 ){ for ( j = 0 ; j < min( i , k ) ; j++){ sum++ } } } what is the time complexityarrow_forwardGive an example of an algorithm that is O(1), an algorithm that is O(n) and an algorithm that is O(n2). Discuss the difference between them.arrow_forwardIn computer science and mathematics, the Josephus Problem (or Josephus permutation) is a theoretical problem. Following is the problem statement: There are n people standing in a circle waiting to be executed. The counting out begins at some point (rear) in the circle and proceeds around the circle in a fixed direction. In each step, a certain number (k) of people are skipped and the next person is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last person remains, who is given freedom. Given the total number of persons n and a number k which indicates that k-1 persons are skipped and kth person is killed in circle. The task is to choose the place in the initial circle so that you are the last one remaining and so survive. For example, if n = 5 and k = 2, then the safe position is 3. Firstly, the person at position 2 is killed, then person at position 4 is killed, then person at position 1…arrow_forward
- Pseudo-random numbers Randomly generating numbers is a crucial subroutine of many algorithms in computer sci- ence. Because computers execute deterministic code, it is not possible (without external influence) to generate truly random numbers. Hence, computers actually generate psuedo- random numbers. The linear congruential method is a simple method for generating pseudo-random numbers. Let m be a positive integer and a be an integer 2 < a <m, and c be an integer 0 ≤ c<m. A linear congruential method uses the following recurrence relation to define a sequence of pseudo-random numbers: In+1=a+c mod m (a) Use the linear congruence method with a = 8, c=5, and m = 14, to compute the first 15 pseudo-random numbers when co= 1. That is, compute zo,X1, X 14- (b) From part (a) we should notice that, with m = 14, the sequence does not contain all 14 numbers in the set Z14. In particular because the sequence is periodic. Using m = 8, determine the value of a which does give all 8…arrow_forward2. Algorithm A has a running time described by the recurrence T(n) = 7T(n/2) + n². A competing algorithm B has a running time described by the recurrence T(n) = aT (n/4) + n². What is the largest integer value for a such that B is asymptotically faster than A? Explain your answer.arrow_forwardFunction f grows no slower than function g. O f (n) = O(g(n) O f (n) = 2(g(n)) O f (n) = o(g(n)) O f(n) = O(g(n))arrow_forward
- Write the algorithm for the problem that works in constant space and time complexity. Input: N OUTPUT: 1 if Tom wins, 0 if Jerry wins.arrow_forwardLet n be an integer such that n>0. Consider the alphabet = {0, 1, 2} and let a,, denote the number of strings over Σ with length n which do not contain two consecutive zeros? Derive a recursive definition for the above scenario.arrow_forwardShow Let f(.) be a computable, strictly monotonic function, that is, f(n+ 1) > f(n) for all n. Show B = {f(n) | n ∈ N} is recursive.arrow_forward
- Suppose that you have five different algorithms (A. B. C. Dand E) for solving a problem. To solve a problem of size n, the number of operations used by each algorithm is as follows. As n grows, which algorithm uses the most operations? Algorithm number of operations n2+n3 B 2n+1 log n100 26 + log n6 nlogn)2 +1 Ainorithmarrow_forward2. For a problem we have come up with three algorithms: A, B, and C. Running time of Algorithm A is O(n¹000), Algorithm B runs in 0(2¹) and Algorithm C runs in O(n!). How do these algorithms compare in terms of speed, for large input? Explain why.arrow_forwardGiven an n-element array X of integers, Algorithm A executes an O(n) time computation for each even number in X and an O(log-n) time computation for each odd number in X. What are the best case and worst case for running time of algorithm C?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education