Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

question C.... explain please and write it in a paragraph format if possible. Ou

ID: 3703995 • Letter: Q

Question

question C.... explain please and write it in a paragraph format if possible.

Outlook Print MAT 2540 - Writing Assignment 1 For each of the items below, write a paragraph addressing each question. (a) Suppose that you step into an elevator at City Tech. There are 7 people in the elevator (including you) and 3 different buttons have been pushed. What is the largest number of people that you can guarantee will exit the elevator at one of the 3 floors selected? Explain. (b) Explain why 1 +2+3+ (n-1)+n O(n). (c) Describe an algorithm, and write the pseudocode, that computes the Lucas numbers. (See problem 11 in section 8.2). pe here to search DOLL

Explanation / Answer

Answers of the questions (3 Parts):

(a)

In the elevator there are 7 people (including me). Since 3 buttons are pressed so on each of these floors one or more person will get down. Taking the minumum of 2 floors as one, it is aparent that 2 person will get down on these two floors.

Therfore reamining will be 5 which will get on the third. This means a maximum of 5 people will get down on any floor in this condition.

Assumption: if the button is pressed means at least one will get down. This is not done by misatke.

(b)

The series is

1+2+3+…………….. +(n-1)+n

By Gauss method this is equal to n(n+1)/2

Converting this into Big O notation O((n^2+n)/2) which will give you O(n^2) time compelxity for doing this calculation.

Normally this is implemneted using for loop as

For (i=0;i<n;i++){

         For (j=i+1;j<N;j++

                  Statement;

}

}

which will be excuted in O(n^2) complexity.

(c)

Edward lucas who gave the Fibonacci series has also provided another series called lucas numbers. This is like this

2 1 3 4 7 11 18. . . . . . . . .

The Fibonacci series is 0 1 1 2 3 5 8 13 . . . . . .

From the analysis of these two series it is apaent that Lucas numbers are just like Fibonacci series except that starting numbers in Lucas numbers are 2 and 1.

Repsenting Lucas numner n

L(n)=(L(n-1)+L(n-2) with initial L1=2 an L2=1

Pseudo Code:

START

Read No of Lucas Number (n)

Iniatialize L1=2

                L2=1

Write L1 and L2

Repeat n-2 times ( from 3 to n){

L(n)=L(n-2)+L(n-1)

Write L(n)

}

STOP.