Skip to main content
Tweeted twitter.com/StackCompSci/status/710654220458921984
Copy-edit, tags
Source Link
David Richerby
  • 82.2k
  • 26
  • 144
  • 238

sort an Complexity of sorting a 1-sorted array in O(nlogk) where k==1 complexity

Supposing we have a KA $k$-sorted array, is one in which every element is at most distance $k$ from its position when the array is sorted. The complexity of sorting such array is in O(n*logk)$O(n\log k)$. But if k equals 1$k=1$, logk would be 0then $\log k=0$ so what happens? What is athe complexity of sorting an array where each element is at most one place away from its sorted position?

sort an array in O(nlogk) where k==1 complexity

Supposing we have a K-sorted array, the complexity of sorting such array is in O(n*logk). But if k equals 1, logk would be 0? What is a complexity of sorting an array where each element is at most one place away from its sorted position?

Complexity of sorting a 1-sorted array

A $k$-sorted array is one in which every element is at most distance $k$ from its position when the array is sorted. The complexity of sorting such array is $O(n\log k)$. But if $k=1$, then $\log k=0$ so what happens? What is the complexity of sorting an array where each element is at most one place away from its sorted position?

Source Link

sort an array in O(nlogk) where k==1 complexity

Supposing we have a K-sorted array, the complexity of sorting such array is in O(n*logk). But if k equals 1, logk would be 0? What is a complexity of sorting an array where each element is at most one place away from its sorted position?