ALL FUNCTIONS IN JAVA AND IN ONE FILE PLEASE
1)
Suppose that each row of an n × n array A consists of 1’s and0’s such that, in any row of A, all the 1’s come before any 0’s inthat row. Write a Python function or Java method for finding therow of A that contains the most 1’s.
Write a recursive Python function or Java method to compute theproduct of two positive integers m and n using only addition.
An array A contains n − 1 unique integers in the range [0, n −1]; that is, there is one number from this range that is not in A.Design an O(n)-time algorithm (write Python function or Javamethod) for finding that number. You are allowed to use only O(1)additional space besides the array A itself.
Write a recursive Python function or Java method for findingboth the minimum and the maximum elements in an array A of nelements. Your method should return a pair (a, b), where a is theminimum element and b is the maximum. What is the running time ofyour method?
没有找到相关结果