PRASHNIKAप्रश्निका
‹ Back to the paper

Design a class BinSearch to search for a particular value in an array. Some of the members of the…

Computer Science202010 marksProgram
Design a class BinSearch to search for a particular value in an array. Some of the members of the class are given below: Class name : BinSearch Data members/instance variables: arr[ ] : to store integer elements n : integer to store the size of the array Member functions/methods: BinSearch(int nn) : parameterized constructor to initialize n=nn void fillarray( ) : to enter elements in the array void sort( ) : sorts the array elements in ascending order using any standard sorting technique int bin_search(int l, int u, int v) : searches for the value ‘v’ using binary search and recursive technique and returns its location if found otherwise returns -1 Define the class BinSearch giving details of the constructor( ), void fillarray( ), void sort( ) and int bin_search(int, int, int). Define the main( ) function to create an object and call the functions accordingly to enable the task.

Answer

No answer yet.

Objects

From ISC 2020 Computer Science Paper 1, question 8.