Moves given minimum element to rear of queue
static void insertMinToRear ( ref Queue < int > q , int min_index ) { int min_val = 0 ; int n = q . Count ; for ( int i = 0 ; i < n ; i ++ ) { int curr = q . Peek ( ) ; q . Dequeue ( ) ; if ( i != min_index ) q . Enqueue ( curr ) ; else min_val = curr ; } q . Enqueue ( min_val ) ; }