Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

) Given a list L consisting of n unordered objects, an item is a majority elemen

ID: 3700270 • Letter: #

Question

)

Given

a list

L consisting

of n

unordered

objects,

an

item

is a majority

element

if its frequency

is greater

than

n/2.

For

example,

in the

list

[C,

C, T, T, C,

T, C, C],

C is the

majority

item,

because

the

frequency

of C is 5, which

is greater

than

4. Another

example,

the

list

[C,

C, T, C, C, S, T, T] has

no majority

item.

These

objects

are

not

ordered.

You

can

only

compare

them

using

equality

as

follows:

L[i]

==

L[j].

Write

an iterative

program,

which

counts

the

frequency

of each

object,

to

determine

the

majority

element

of a list

of objects.

Your

program

should

return

an

object

or None,

in case

there

is no

majority

element.

def

iterative_majority_finding(L):

# your

code

goes

here

Explanation / Answer

NOTE: I solved this question without using comparator operator "==".