Question: 1.7 StdintArray.anyOf Add a function called anyof to stdIntArray, which returns true if any array or sub-array element matches a given value, and false otherwise.

1.7 StdintArray.anyOf Add a function called anyof to stdIntArray, which returns true if any array or sub-array element matches a given value, and false otherwise. There should be two versions, one that works with the entire array, and one that works with sub-array defined by a half-open range. The signatures should be public static boolean anyof (int al], int value) public static boolean anyof (int al], int lo, int hi, int value) The version that works with the entire array should call the sub-array version, just like we did in class with the other stdIntArray functions For example, assume that array a (1, 1, 4, 9, 9, 5, 7, 5). Then anyof (a, 1) returns true anyof (a, 2) returns false anyof (a, 5) returns true anyof (a, 8) returns false anyof (a, 2, 6, 1) returns false anyof (a, 2, 6, 4) returns true anyof (a, 2, 6, 5) returns true anyof (a, 2, 6, 7) returns false anyof (a, 2, 2, 4) returns false Note that false is returned for any empty sub-array Your function may assume that e s lo s hi s a.length
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
