Java:
Write a method to measure to sortedness of an array. Thesortedness is the degree to which data is sorted, ranging from 0 to100%.
There are different ways to measure the degree of sortedness.For the homework, compare neighbor elements. The degree ofsortedness is the percentage of neighbor-matches that are in sortedorder.
For our purposes, we are considering only ascending order(smallest to largest) as being sorted.
- Example: [2, 2, 4, 6, 7] has 100% sortedness: all neighborpairs of numbers are sorted
- Example: [2, 2, 6, 4, 7] has 75% sortedness: the 6-4 neighborpair is not sorted, but all other neighbor pairs (2-2, 2-6, and4-7) are sorted;
OR
PayPal Gateway not configured
ORPayPal Gateway not configured