Answer Posted / fish
int a1(int[] a)
{
int max1 = -1;
int max2 = -1;
for (int i=0; i<a.length; i++)
{
if (a[i] > max1)
{
max2 = max1;
max1 = a[i];
}
else if (a[i] != max1 && a[i] > max2)
max2 = a[i];
}
return max2;
}
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
Is c++ platform dependent?
What is the this pointer?
Can c++ do everything c can?
Difference between delete and free.
What is c++ code?
What is polymorphism and its type in c++?
What is type of 'this' pointer? Explain when it is get created?
What do manipulators do?
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
What is rvalue?
Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.
What is c++ programming language?
Can user-defined object be declared as static data member of another class?
Is java as fast as c++?
In inline " expression passed as argument are evalauated once " while in macro "in some cases expression passed as argument are evaluated more than once " --> i am not getting it plz help to make me understand....