'Quicksort to generate a nearly sorted output with K error
I need to change the psuedo code
To output a nearly sorted array where an element is at a maximum of K away from it's sorted position. For example the array 6,1,2,3,4,7 is sorted for K=4, because 7>6 and their distance is larger than K. I tried simply changing the calls to this or instead of K using K/2 since i want half the distance on both sides of the partition. i don't think it works since i tried implementing this in java. Any help would be really helpful, Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
