I want to implement this without using the sorted function (perhaps by using a priority queue):
dic=collections.Counter(nums)
sorted_dic= dict(sorted(dic.items