human
Cumulative frequency of count of each element in an unsorted array | Function to print the cumulative frequency according to the order given.
Insert elements and their frequencies in hash map ..
traverse in the array.
add the frequencies.
if the element has not been visited previously.
mark the hash 0 as the element 's cumulative  frequency has been printed.
Driver Code"
How can the above be solved in Python?
 ... What is a code to cumulative frequency of count of each element in an unsorted array and the other steps required?
assistant
#Here is code to cumulative frequency of count of each element in an unsorted array and the other steps required.
 def countFreq ( a , n ) :
	hm = dict ( )
	for i in range ( n ) :
		hm [ a [ i ] ] = hm . get ( a [ i ] , 0 ) + 1
	cumul = 0
	for i in range ( n ) :
		cumul += hm [ a [ i ] ]
		if ( hm [ a [ i ] ] > 0 ) :
			print ( a [ i ] , " - > " , cumul )
		hm [ a [ i ] ] = 0
a = [ 1 , 3 , 2 , 4 , 2 , 1 ]
n = len ( a )
countFreq ( a , n )