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

Note that the “second largest number” is the numberthat is bigger than all the o

ID: 3611329 • Letter: N

Question

Note that the “second largest number” is the numberthat is bigger than all the other

numbers except one; equivalently, it is the element that issmaller than exactly one other

element. To ensure that this definition works, you may assumethat there are at least two

elements in the array, and that all the array elements aredistinct. For example, if the array

contains the following 6 numbers (i.e. n = 6):3, -2, 4, -6, 7, 1; then the second largest

number is 4, which is smaller than 7 but larger than all theother elements.

The prototype of your function must be:

int secondLargest (int* A, int n)

Here, A is the array of integers andn is the number of elements in that array.This

function will find and return the second largest element amongthe n elements of the

array A.

Note: You are not allowed to change the contents of thegiven array. Moreover, you are

also not allowed to make a copy of the array’selements.

Hint# 1: You may need at least one helper function.

Hint# 2: Exactly one number is larger than the secondlargest number.

Explanation / Answer

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote