# Complexity of while loop Average,Best,worse case

int[]A;
int L=A.length-1;
int index=(L-1)/2;

int k=2*index+1;
while(k<n){
if(k+1<n){
if(A[k]<A[k+1]) k=k+1;}
if(A[index]<A[k]){
int t=A[index];
A[index]=A[k];
A[k]=t;
index=k;
k=2*index+1;
}else break;

• Are you asking us to do your homework for you? Because it looks like you're asking us to do your homework for you. – Turksarama Dec 16 '19 at 1:47
• What did you try? Where did you get stuck? We're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question. – D.W. Dec 16 '19 at 2:13