Driver program to test above
int main ( ) { int arr [ ] = { 3 , 2 , 1 , 5 , 6 , 4 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int k = 2 ; cout << " Is ▁ it ▁ a ▁ k ▁ sorted ▁ array ? : ▁ " << isKSortedArray ( arr , n , k ) ; return 0 ; }