Question: Write a program whose input is an array A and a number a. The program should print the number of occurrences of a in A.

Write a program whose input is an array A and a number a. The program should print the number of occurrences of a in A. You may not use recursion for this particular task. 3. (a) (5 marks) (5 marks) Write a recursive program for the same task as in (a). Write a program whose input is an array A and the output is YES if A contains an element occurring only once and NO otherwise. For instance, the answer for A [2,7,7, 2,8, 7,8] should be NO because each element occurs at least twice, whereas the answer for A [2,7, 4,7,2,8, 8] is YES because 4 occurs only once. (10 marks) (b) (c)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
