I think the order should be 2-1-3-4, but the description of step 1 is confusing. In selection sort, you iterate from the point of the marker down through the entire list and find the smallest value, and swap that with the value at the marker. Then you advance the marker and repeat the process on the remainder of the list.
Answer:
1.) 25 ; 15 ; 15
2.) 50 ; 15 ; 50
Explanation:
In the first function written :
The variable val was initially decaled or assigned a value of 25 and that was what was printed first.
However, after the example function was written, the val variable was finally assiagned a value of 15 within the function. However, it was also declared that the global variable takes uonthe val value. Hence, the val variable initially assigned a value, of 25 changes to 15 globally.
For the second code :
From the top:
Val was assigned a value of 50 ;
Hence,
print(val) gives an output of 50
Within the function definition which prints the value of val that is assigned a value of 25 within the function.
Since tbe global variable isnt reset.
Printing Val again outputs 50;since ito is outside the function.
Highlight the row(20), then click on the insert cells button under the home ribbon.
Answer:
Since the language isn’t stated, I’ll give answers in the two most-used (?) languages: Java and Python.
a) To print a’s value 3 times in the same line, in Java we would do:
System.out.print(a+a+a);
In Python, we would write:
print(a*3)
b) 2 times in different lines using one print statement
In Java, we would write
System.out.println(a+”\n”+a+”\n”+a);
In Python we would write:
print(a,a,a,sep=’/n’)
Hope this helps!