//Arrange action void arrange(int n, Type start[], Type end[], boolean used[]) {int i, j = 0; Sort_ASC(n, start, end);// sort by the array of end[] : ascend used[0] = true; for(i = 1; i < n; i++) { if(start[i] >= end[j])//if ( the next start time >= the last end time ) this action will be OK { used[i] = true; j = i; } else { used[i] = false; } } }