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



Assume an array of structure is in order by studentID field of the record, where student IDs go fr..

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

Post New Answer

More C++ General Interview Questions

What is function overloading in C++?

2 Answers  


What does #define mean in c++?

1 Answers  


What is volatile and pragma? When they are used?

1 Answers  


Give an example of run-time polymorphism/virtual functions.

1 Answers  


Describe protected access specifiers?

1 Answers  


Which bit wise operator is suitable for putting on a particular bit in a number?

1 Answers  


How a macro differs from a template?

1 Answers  


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.

1 Answers  


What is one dimensional array in c++?

1 Answers  


What is #include cstdlib in c++?

1 Answers  


What are the three forms of cin.get() and what are their differences?

1 Answers  


What is #include iostream?

1 Answers  


Categories