Examlex

Solved

Consider the Following Implementation of Insertion Sort

question 8

Multiple Choice

Consider the following implementation of insertion sort:
Public static void insertionSort(int [ ] array) {
Int unsortedValue;// The first unsorted value
Int scan;// Used to scan the array
// The outer loop steps the index variable through
// each subscript in the array,starting at 1.This
// is because element 0 is considered already sorted.
For (int index = 1;index < array.length;index++) {
// The first element outside the sorted segment is
// array[index].Store the value of this element
// in unsortedValue
UnsortedValue = array[index];
// Start scan at the subscript of the first element
// outside the sorted segment.
Scan = index;
// Move the first element outside the sorted segment
// into its proper position within the sorted segment.
While (scan > 0 && array[scan-1] > unsortedValue) {
Array[scan] = array[scan - 1];
Scan --;
}
// Insert the unsorted value in its proper position
// within the sorted segment.
Array[scan] = unsortedValue;
}
}
This method uses the < and > operators to compare array subscripts,as when index is compared against the length of the array,a.length.The method also uses these operators to compare array elements against each other,for example,in an expression such as a[scan-1] >unSortedValue.What would happen if we change every < operator to >,and change every > operator to < ?

Recognize the relationship between operating efficiencies, productivity, and competitive advantage.
Define technology in the context of organizational operations and output transformation.
Describe the principles of sustainable and environmentally responsible manufacturing practices.
Understand the role of technology in achieving competitive advantage and the types of technology used in different production processes.

Definitions:

Average Run Length

In statistical process control, it is the expected number of samples taken until a control chart signals a possible shift in process parameters.

Control Chart

A tool used in process control to monitor, control, and identify the stability of a process over time.

Process

A series of actions or steps taken in order to achieve a particular end.

Statistical Process Control

A method used to monitor, control, and ensure the quality of processes by using statistical methods.

Related Questions