Question: ( 2 5 points ) Let A [ 1 . . n ] be an array of n elements. One can compare in O (
points Let be an array of elements. One can compare in
time two elements of to see if they are equal or not; however,
the order relations and do not make sense. That is one can check
whether in time, but the relations kkkkAqin and
are undefined and cannot computed.
Write your algorithm documented pseudocode. Also,
plain text what your pseudocode does. Explain the cor
rectness your algorithm.
Since your algorithm uses the divideandconquer principle, should
recursive nature. That should work the
first call return all major elements and subsequent
recursive calls, may recurse many subarrays for some
qin return all major elements
Given a particular subarray major element
not necessarily major element Conversely, major
element not necessarily major element
points Derive a recurrence relation that describes the running time
your algorithm. Explain your reasoning. State the boundary
condition
points Solve your recurrence from scratch show that
and
are undefined and cannot determined.
the tutorial you developed time divideandconquer algo
rithm for finding a majority element one exists. this assignment
you need generalize this problem.
Let kin a fixed integer. element major
element its number occurrences greater than For example,
then major element should occur greater than times
least times Note that possible that major exists for
a particular ; also possible that there are multiple major elements
for a particular
This problem concerns with designing a divideandconquer algorithm for
finding all major elements time; there
major element, report Answer the following questions.
points What the maximum number major elements
Explain.
points Design a divideandconquer algorithm that finds all
major elements time; there major
element, your algorithm should report Recall that one can check
whether time, but the relations and
are undefined and cannot computed.
Write your algorithm documented pseudocode. Also,
plain text what your pseudocode does. Explain the cor
rectness your algorithm.
Since your algorithm uses the divideandconquer principle, should
recursive nature. That should work the
first call return all major elements and subsequent
recursive calls, may recurse many subarrays for some
qin return all major elements
Given a particular subarray major element
not necessarily major element Conversely, major
element not necessarily major element
points Derive a recurrence relation that describes the running time
your algorithm. Explain your reasoning. State the boundary
condition
points Solve your recurrence from scratch show that
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
