-- create BST with freq property updated if duplicate is inserted
-- do inorder traversal and store the data and freq of each node in an auxiliary array count => [{data:data,freq:freq}]
-- sort the count array with descending frequency
-- traverse the array and print every data element in count count[i].freq times