Calculate the k-th power and recursive algorithem, Data Structure & Algorithms

Assignment Help:

1. The following is a recursive algorithm to calculate the k-th power of 2.

Input k a natural number
Output kth power of 2
Algorithem:
If k =0then return 1
Else return 2* power _of_2(k-1)

Please review the decomposition of a recursive algorithm described in slide #17 (week 1, 3-Recursion-IterativeAlgorithms.pdf). Please show the decomposition whne k = 5.

2. Please write an iterative algorithm to calculate the k-th power of 2. This iterative algorithm should be equivalent to the recursive algorithm in question 1.

3. Reorder the following time efficiencies from largest to smallest:

a) nlog n

b) 52

c) n + n2 + n3 + n4

d) n3

e) n5 log n

4. Determine the big-O notations for the following time efficiencies and reorder them from largest to smallest:

a) 50n3 + n2 + log n + n +10000

b) 2n5 +100n2 +1000log n

c) 200n + n2 log n

d) 10log n + n2 log n +10n4

5. Describe the information flow among DNAs, RNAs, and proteins


Related Discussions:- Calculate the k-th power and recursive algorithem

Define about the class invariant, Define about the class invariant A cl...

Define about the class invariant A class invariant may not be true during execution of a public operation though it should be true between executions of public operations. For

Complexity of an algorithm, Q. Explain the complexity of an algorithm?  Wha...

Q. Explain the complexity of an algorithm?  What are the worst case analysis and best case analysis explain with an example.

Sparse matrix, How sparse matrix stored in the memory of a computer?

How sparse matrix stored in the memory of a computer?

Determine the class invariants- ruby, Determine the class invariants- Ruby ...

Determine the class invariants- Ruby Ruby has many predefined exceptions classes (like ArgumentError) and new ones can be created easily by sub-classing StandardError, so it's

Operations on sequential files, Insertion: Records has to be inserted at t...

Insertion: Records has to be inserted at the place dictated by the sequence of keys. As is obvious, direct insertions into the main data file would lead to frequent rebuilding of

Post order traversal, Post order traversal: The children of node are vi...

Post order traversal: The children of node are visited before the node itself; the root is visited last. Each node is visited after its descendents are visited. Algorithm fo

Explain backtracking, Explain Backtracking The  principal idea is to co...

Explain Backtracking The  principal idea is to construct solutions single component  at a time  and evaluate such  partially constructed candidates as follows. If a partiall

Hashing, what is hashing? what are diffrent method of hashing?

what is hashing? what are diffrent method of hashing?

Array, how to define the size of array

how to define the size of array

Creation of a linked list, Program: Creation of a linked list In the ne...

Program: Creation of a linked list In the next example, wewill look to the process of addition of new nodes to the list with the function create_list(). #include #includ

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd