Process Description of Selection Sort

Embed Size (px)

Citation preview

  • 8/22/2019 Process Description of Selection Sort

    1/4

    Process Description of Selection Sort

    Introduction

    Selection sort is an iterative process in which a list of unsorted data is placed in either ascending or

    descending order. Selection sort gets its name from the way in which the data are sorted. During each

    iteration, the smallest value from a list of unsorted numbers is selected and then inserted in the front of

    the list. As the process continues, the sorted area in the front of the list gets larger, while the remaining

    unsorted area gets smaller. At some point, when all the numbers from the unsorted list have been

    selected and inserted, the list is sorted, and the process is complete. The selection sort process involves

    the following iterative steps: evaluation, identification, and insertion. See Figure 5.2 for a flowchart of

    the process.

    Discussion

    Evaluation is the scanning process in which the list of numbers is tested for proper order. This step

    normally involves a pass through the list where a series of comparisons of adjacent numbers determines

    whether the list is ordered. If the list is ordered, the process is complete and ends. If the list is not

    ordered, then the lowest value is identified.

    Identification is the scanning process by which the lowest value in the list is located. Normally, the

    lowest value is identified by a series of comparisons and swaps. Once identified, the value can be

    inserted.

    Insertion is a relocation process in which the lowest value in the unsorted area of the list is placed or

    inserted in the front of the list. On the first iteration, this value starts the ordered or sorted area of the

    list, while the remaining numbers constitute the unsorted or unordered area of the list. Once the lowest

    value has been inserted, the process returns to the evaluating step, where the iteration continues until

    no unordered numbers remain (see Figure 5.3 for an example).

    Conclusion

    Selection sort is an iterative process in which a list of unsorted data is placed in either ascending or

    descending order. During each iteration, the list is evaluated to see if it is, in fact, ordered. If not, the

    smallest value from a list of unsorted numbers is selected and then moved to the front of the list. As the

    process continues, the sorted area in the front of the list gets larger, while the remaining unsorted area

    gets smaller. At some point, when all the numbers from the unsorted list have been moved, the list is

    sorted and the process is complete. Insertion sort is one of the many algorithms used by computerprogrammers to sort lists of data.

  • 8/22/2019 Process Description of Selection Sort

    2/4

    START

    Figure 5.2

    Selection sort flowchart

    Description of the Operation of an Air Conditioner

    Introduction

    An air conditioner is a mechanical device used to refrigerate a controlled environment. The air

    conditioner accomplishes this refrigeration by transferring heat within the environment to an area

    outside the environment. The air conditioner transfers heat using a fluid refrigerant. This refrigerant is

  • 8/22/2019 Process Description of Selection Sort

    3/4

    pumped through both the controlled environment and outside the area. At the same time, the

    refrigerant is cycled at strategic points between liquid and vaporous states. This change in state provides

    the means for transferring thermal energy.

    The air conditioners operation is centered on four major components, including the compressor,

    condenser coil, expansion valve, and evaporator coil. The operation of the air conditioner relatesdirectly to these parts and includes the following steps: compression, condensation, expansion, and

    evaporation. See Figure 5.1.

    Discussion

    Compression is a fluid- dynamics process in which a given volume of refrigerant vapor is forced to

    occupy a smaller volume of space. Compression occurs when the compressor forces hot refrigerant

    vapor under pressure into the compression chamber. The chamber is composed of a cylinder/valve

    arrangement. The piston draws refrigerant into the cylinder through an intake; the intake valve closes;

    and the piston pushes up into the cylinder, compressing the refrigerant vapor. The vapor then exits

    through an exhaust valve and enters the condenser coil, where the condensation step occurs.

    Condensation is a fluid-dynamics process in which the hot refrigerant vapors, pumped from the

    compressor to the condenser coil, cool and change to liquid. As this change occurs, the heat of

    condensation is released from the refrigerant in the condenser coil, heating the coil. This heat in turn, is

    drawn from the coil by a fan, which passes relatively cooler air across the coil picking the heat andventing it outside. The refrigerant liquid then flows through a closed loop to the expansion valve, where

    rapid expansion occurs.

    Expansion is a fluid-dynamics process in which the condensed liquid refrigerant, under relatively high

    pressure from the compressor, is forced through an expansion valve into an area of substantially lower

    pressure. The expansion valve acts as nozzle, constricting and then accelerating the liquid refrigerant

    until it passes through a threshold where the constriction is removed and rapid expansion occurs. At this

    point, the expanding refrigerant enters and the evaporator coil, where it will cool and change state

    again.

    Evaporation is a fluid-dynamics process in which the rapidly expanding refrigerant liquid changes to a

    vapor. As the liquid enters the evaporator coil, it also enters an area of substantially lower pressure. As a

    result, it vaporizes and in the process absorbs heat. Air in the controlled environment is circulated across

    this coil, which, in turn, absorbs heat from the air. The fan distributes the resulting cool air throughout

    the controlled environment. The refrigerant vapor in then evaporator coil is then drawn back through

    the closed loop to the compressor, At which point the entire cycle repeats.

    Conclusion

    The operation of an air conditioner involves four steps. First, the compressor pumps refrigerant under

    pressure into the condenser coil. Here, it is liquefied, giving up heat that is removed by a fan circulating

    air over the condenser coil. The liquid refrigerant moves through a closed loop, through an expansion

    valve, and into the lower- pressure evaporator coil. Here, the refrigerant changes to a vapor, absorbing

    heat from air passing over the evaporator coil. The air then cools the controlled environment, while the

    refrigerant is drawn back into the compressor. At this point the cycle is complete, and the process

    repeats.

  • 8/22/2019 Process Description of Selection Sort

    4/4