Sorting without comparison of elements | Represents node of a doubly linked list ; Count of elements in given range ; Count frequencies of all elements ; Traverse through range . For every element , print it its count times . ; Driver Code
def sortArr ( arr , n , min_no , max_no ) : NEW_LINE INDENT m = max_no - min_no + 1 NEW_LINE c = [ 0 ] * m NEW_LINE for i in range ( n ) : NEW_LINE INDENT c [ arr [ i ] - min_no ] += 1 NEW_LINE DEDENT for i in range ( m ) : NEW_LINE INDENT for j in range ( ( c [ i ] ) ) : NEW_LINE INDENT print ( ( i + min_no ) , end = " ▁ " ) NEW_LINE DEDENT DEDENT DEDENT arr = [ 10 , 10 , 1 , 4 , 4 , 100 , 0 ] NEW_LINE min_no , max_no = 0 , 100 NEW_LINE n = len ( arr ) NEW_LINE sortArr ( arr , n , min_no , max_no ) NEW_LINE