Bài 15. Bài toán tin học

datcoder

Vẽ sơ đồ khối của giả thuật sắp xếp nổi bọt để sắp xếp một dãy số theo thứ tự tăng dần.

Người Già
23 tháng 5 lúc 21:04
Sơ đồ khối

Học sinh dựa vào dòng code sau vẽ ra sơ đồ khối

Start

└─ Input an unsorted array of numbers

└─ Set n as the length of the array

└─ Repeat the following steps for i from 0 to n-1

   └─ Repeat the following steps for j from 0 to n-i-1

      └─ If the j-th element is greater than the (j+1)-th element

         └─ Swap the j-th and (j+1)-th elements

└─ Output the sorted array

End