Login or Create an Account to view the mark scheme, comment, and add to a test
A number in an array is considered "small" if and only if it has two neighbouring elements which are both of greater value. For example, in the following array, 7 and 14 are considered "small".
[5]
[3, 9, 20, 14, 35, 7, 11, 98, 2]
Given an empty Collection called NSMALLS as well as a full array of size 100 called NUMBERS (which contains only positive integers), construct an efficient algorithm to copy all "small" numbers from NUMBERS into NSMALLS.

Short Answer5 MarksPremium
9 Uses41 Views0 Likes