Ad
  • Default User Avatar

    I thought that the java sort method for a primative array used quick sort? since they will be sorting a nearly sorted array on almost every iteration, i think the runtime would be closer to O(N*M^2).

  • Default User Avatar

    During each iteration, the array is sorted. result[0] is the slot with the smallest value, the next register that can take a customer. Initializing result to size n creates the a slot for each "register".

  • Default User Avatar

    By any chance can someone explain this code please?
    If we are using only result[0] (only the first element in the array) why initialize it with result[n] ?