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
Answer / Romesh Kumar Singh
[Pseudocode:ntfunction findNearEndStudentRecord(studentArray, startID, endID) {nttfor i from (N-1) down to 0 {ntttif (studentArray[i].studentID >= startID && studentArray[i].studentID <= endID) return studentArray[i];ntt}nttreturn null;n}
| Is This Answer Correct ? | 0 Yes | 0 No |
What is function overloading in C++?
What does #define mean in c++?
What is volatile and pragma? When they are used?
Give an example of run-time polymorphism/virtual functions.
Describe protected access specifiers?
Which bit wise operator is suitable for putting on a particular bit in a number?
How a macro differs from a template?
I was a c++ code and was asked to find out the bug in that. The bug was that he declared an object locally in a function and tried to return the pointer to that object. Since the object is local to the function, it no more exists after returning from the function. The pointer, therefore, is invalid outside.
What is one dimensional array in c++?
What is #include cstdlib in c++?
What are the three forms of cin.get() and what are their differences?
What is #include iostream?