Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

DISTINQUISH BETWEEN THE AVERAGE CASE AND WORSE CASE RUNNING TIME AND THE FACTORS AFFECTING THAT AFFECTS THE RUNNING TIME OF AN ALGORITHM

// Return position of largest value in integer array A
static int largest(int[] A) {
  int currlarge = 0;             // Position of largest element seen
  for (int i=1; i<A.length; i++) // For each element
    if (A[currlarge] < A[i])     //   if A[i] is larger
       currlarge = i;            //     remember its position
  return currlarge;              // Return largest position
}
 
PREVIOUS NEXT
Tagged: #DISTINQUISH #BETWEEN #THE #AVERAGE #CASE #AND #WORSE #CASE #RUNNING #TIME #AND #THE #FACTORS #AFFECTING #THAT #AFFECTS #THE #RUNNING #TIME #OF #AN #ALGORITHM
ADD COMMENT
Topic
Name
2+4 =