PROGRAMMING STUDY CASE (ARRAY & VALIDATION)

PROGRAMMING STUDY CASE (ARRAY & VALIDATION)
In programming the cases base often happened have never got out of some repetition techniques and condition.
As for the case dealing with the repetition and condition is [at] programming presenting array ( queue) and validate.
ARRAY & VALIDATION
Usage Flowchart for analysis array will always use the repetition method ( looping). Then process Arrange require the sequence technique and queue.
There are some the Algorithm sequence techniques often in using:
  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort
  4. Shell Sort
  5. Merge Sort
  6. Heap Sort
  7. Quick Sort
  8. Bucket Sort
  9. Radix Sort
Bubble Sort
Step for the shake of step Bubble Sort:
Take example is array ( 70519) then will in sorting from small which become larger ones:
First Step :
(7 0 5 1 9) → (0 7 5 1 9) , membandingkan 2 element pertama kemudian tukar posisi.
(0 7 5 1 9) → (0 5 7 1 9)
(0 5 7 1 9) → (0 5 1 7 9)
(0 5 1 7 9) → (0 5 1 7 9), 2 element terakhir telah terurut sehingga tidak di tukar.
Second Step :
(0 5 1 7 9) → (0 5 1 7 9)
(0 5 1 7 9) → (0 1 5 7 9)
(0 1 5 7 9) → (0 1 5 7 9)
(0 1 5 7 9) → (0 1 5 7 9)
Now, all lines have been massaged, is but needed to check again without happened the repetition, to prove that line have been massaged by the correctness.
(0 1 5 7 9) → (0 1 5 7 9)
(0 1 5 7 9) → (0 1 5 7 9)
(0 1 5 7 9) → (0 1 5 7 9)
(0 1 5 7 9) → (0 1 5 7 9)
Finally [there] no conversion process element so that prove that line have been massaged.
Flowchart to explain the above algorithm as follows:

PsedoCode (Algorithm Syntax):
procedure bubbleSort( L : list of sortable items ) defined as:
  do
    Terurut := false
    for each I in 0 to length( L ) - 1 do:
      if L[ I ] > L[ I + 1 ] then
               Temp := L[I]
               L[I] := L[I + 1]
               L[I + 1] := Temp
        Terurut := true
      end if
    end for

No comments: