Question: find _ mode ( arr: DynamicArray ) - > tuple [ DynamicArray , int ] : Write a standalone function outside of the DynamicArray class
findmodearr: DynamicArray tupleDynamicArray int:
Write a standalone function outside of the DynamicArray class that receives a dynamic array
already in sorted order, either nondescending or nonascending. The function will return a
tuple containing in this order a dynamic array comprising the mode mostoccurring
values of the array, and an integer that represents the highest frequency how many times
they appear
If there is more than one value that has the highest frequency, all values at that frequency
should be included in the array being returned in the order in which they appear in the input
array. If there is only one mode, only that value should be included.
You may assume that the input array will contain one or more homogeneous
elementseither all numbers, or strings, or custom objects, but never a mix of these You
do not need to write checks for these conditions.
For full credit, the function must be implemented with ON complexity with no additional
data structures beyond the array you return being created. Note: You can
replace the return array as needed
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
