Design and Analysis of Algorithms - Old Questions
Question Answer Details
1. Use RAM model to estimate the big-oh of the running time for following code segment.
for(i=0;i<n;i++){
small pos = i;
smallest
= Array[small pos];
for(j=i+1;
j<=n; j++){
if(Array[j]<smallest){
small
pos = j;
smallest=Array[small
pos];
}
}
Array[small
pos]=Array[i];
Array[i]
= smallest;
Answer
AI Generated Answer
AI is thinking...