Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

------------ ------------------------------------ Question 22) Question 11) ----

ID: 3576337 • Letter: #

Question

------------------------------------------------ Question 22)
Question 11)

------------------------------------------------



The following is the definition of the LET language. Esch production is followed by a constructor. Program: Expreasion a program (expl) Expression Number const-exp (num) Expression -(Expression Expression) diff-exp (exp1 exp2) Expression zero? (Expression) zero?-exp (exp1) Expression if Expression then Expression else Expression if-exp (exp1 exp2 exp3) Expression Identifier var exp (var) Expression let Identifier Expression in Expression let-exp (var expl body) The default environment is li- fil,v z- v-R51,

Explanation / Answer

public static void sort(Comparable[] a) {
int n = a.length;
for(int i=0;i<n;i++)
    for(int j=i;j>0;j--)
        if(a[j].compareTo(a[j-1])<0)
            exchange(a,j,j-1);
        else break;
}