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

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
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

Posted Date: 3/13/2013 1:23:35 AM | Location : United States

Related Discussions:- Calculate the k-th power and recursive algorithem, Assignment Help, Ask Question on Calculate the k-th power and recursive algorithem, Get Answer, Expert's Help, Calculate the k-th power and recursive algorithem Discussions

Write discussion on Calculate the k-th power and recursive algorithem
Your posts are moderated
Related Questions
A striking application of DFS is determine a strongly connected component of a graph. Definition: For graph G = (V, E) , where V refer to the set of vertices and E refer to the

Explain the Interfaces in Ruby Recall that in object-oriented programming, an interface is a collection of abstract operations that cannot be instantiated. Even though Ruby i

Containers Introduction Simple abstract data types are useful for manipulating simple sets of values, such as integers or real numbers however more complex abstract data t

Question 1 Discuss the advantages of implementation checks preconditions Question 2 Write a ‘C' program to search for an item using binary search Question 3 Show that To

Your objective is to write a generic doubly linked list class called CS228LinkedList that implements the List interface and uses a type variable T. All methods except for subList a

Program: Program segment for insertion of an element into the queue add(int value) { struct queue *new; new = (struct queue*)malloc(sizeof(queue)); new->value = val

Develop a program that accepts the car registration( hint: LEA 43242010)

Question 1 Explain the use of algorithms in computing Question 2 Explain time complexity and space complexity of an algorithm Question 3 Explain how you can analyz

Description A heap is an efficient tree-based data structure that can be used as a priority queue. Recall that the abstract data type of a priority queue has the following opera

D elete a specific Node from Double Linked List as follows DELETEDBL(INFO, FORW, BACK, START, AVAIL,LOC) 1. [Delete Node] Set FORW [ BACK [LOC]]:= FORW[LOC]& BACK [FORW[