[SOLVED] CE3345 Assignment I

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-3-nukr87.zip (225.2 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)
  1. Write a recursive method in pseudo code that returns the number of 1’s in the binary representation of N. Use the fact that this equal to the number of 1’s in the representation of N/2,

plus 1, if N is odd.                                                                                                                             [10 Points]

 

  1. Evaluate the following sums:                                                                                                 [10 Points]

 

 

  1. ∑𝑖∞ 4𝑖

 

  1. Let Fi be the Fibonacci numbers. Prove the following:                                                      [5 Points]

 

∑𝑁𝑖=−12 𝐹𝑖 = 𝐹𝑁 − 2

 

  1. Prove by induction                                                                                                                          [5 Points]

 

 

𝑛2 (𝑛 + 1)2

13 + 23 + 33 + … … … … … + 𝑛3 =  

4

 

  1. Suppose your calculator only did base 10 logarithms, write an expression to compute log base 2 of 64 using log base 10. [5 Points]
  2. An integer subarray is called alternating if any two consecutive numbers in it have opposite signs (i.e. one of them should be negative, whereas the other should be positive).

 

Given an array of n integers, write a pseudocode to compute for each index i, the length of the

longest alternating subarray starting at i.                                                                               [15 Points]

For example:

 

Input : a[] = {1, -5, 1, -5}

Output : For index 0, {1, -5, 1, -5} = 4

index 1, {-5, 1, -5} = 3              index 2, {1, -5} = 2              index 3, {-5} = 1.

 

Input :a[] = {-5, -1, -1, 2, -2, -3} Output : index 0, {-5} = 1          index 1, {-1}  = 1          index 2, {-1, 2, -2} = 3          index 3, { 2, -2} = 2

index 4, {-2} = 1

index 5, {-3} = 1

  • Assignment-3-nukr87.zip