1
write a function called search for last occurence that takes as parameters an array of integers, an integer key value, and the array size. the function should search for the last occurrence of the key value in the array and return its position in the array, or return -1 if the value is not found in the array.
the function prototype is: int search for last occurence (int arr[ ],int key, int size);
2
write a function called display all occurences that takes as parameters an array of integers, an integer key value, and the array size . the function should search for all occurrences of the key value in the array and display their position in the array , i the value is not found in the array , the function should display a message saying that the value is not found i the array.
the function prototype is; void display all occurences (int arr[ ], int key , int size);
3
write a function named insert new element that takes as parameters: an array of integers, an the number of elements in the array. assume that the elements in the array are sorted in ascending order, the function should add the new element in a way that the element in the array will remain sorted.
the prototype of the function is; void insert new element (int arr[ ], int new element , int length);
4
part A
write a function named shift to right that takes as parameters: an array of integers, array length which is passed by reference ,and a position (index) in the array pos. the function should shift the elements of the array on step to the right from pos an increment the array size by 1.
the prototype of the function is; void shift to right (int arr[ ], int & length, int pos );
4
part B
write a function named insert one that takes as parameters: an array of integers, number of elements in the array which is passed by reference ,and a constant array size. the function should insert '1' after all occurrences of the sequence '100' un the array when there ia a place in the array to insert new element. use the above function shift to right to shift the elements before insertion.
the prototype of the function is; void insert one (int arr[ ], int & length, const int size );
5
part A
write a function named insert at position that takes an array of integers x , the number of elements stored in the array which is passed by reference xnum , a positive integer pos that represents a position (subscript) in the array , and an integer number value. the function should insert the value at the position specified pos.
the prototype of the function is; void insert at position (int x[ ], int & xnumptr, int pos, int value );
if pos=2, value=10, and the content of the array xbefore calling the function is:
5
part B
write a function named insert seven that takes an array of integers x , the number of elements stored in the array which is passed by reference xnum ,and the maximum array size max-size. the function should insert the number seven(7) in the proper position. the number of elements stored in the array should not exceed max-size.
the prototype of the function is; void insert seven (int x[ ], int & xnumptr, intmax-size);