Starting from:

$29.99

Assignment 13 1. Suppose you are given a square matrix

Assignment 13
1. Suppose you are given a square matrix. Create arrays of its anti-diagonals using Java.
a. Example:
Matrix: 1 2 4
3 7 9
8 5 6
Arrays should: [1]
[2 3]
[4 7 8]
[9 5]
[6]
2. Replace every element of a given array with the next greatest element.
Example: i/p array {23, 2, 100, 45, -5, 7, -2, 9} o/p array {100, 100, 100, 45, 9, 9, 9, 9}
3. Write a program to get the difference between the largest and the smallest numbers.
4. Find the number of even and odd integers in a given array of integers.
5. Print all the Leaders of an Array. [An element is leader if it is greater than all the
elements to its right side, e.g. if array is given as {20, 19, 34, 53, 25, 0, 11} then output
should be {53, 25, 11}.
6. Remove the duplicate elements of a given array {12, 5, 15, 12, 5, 22, 4, 15} and return
the new length of the updated array.
7. Find the majority element from a given array of integers containing duplicates.
Majority element: A majority element is an element that appears more than n/2 times
where n is the size of the array.

More products