In working with information, the most advantageous ways of storing it are structures and arrays. The latter can contain any of the same type of data that is convenient to use in the program. They are often used in online stores and in game development. Therefore, the data contained in them are repeatedly sorted and interchanged, and logical or mathematical operations are performed on them. One way to clean up an array is through bubble sorting. This publication will examine its C code and permutation logic.
Array Sort Algorithm
, - . . . , .
. , . 8 0 . . 5 . 5 3 — . , , 5 . , — 3 9. .
, : , . , . - .
. . , , . . , . , , .
, , , - . , , . N- N . . .
. void. , . .
, . , . . — 100 .
, , , . , scanf(«%d», &value). «%d» - , , . value , .
, . , , : BubleSort(dataArray, sizeDataArray). , , . , dataArray – , , sizeDataArray – .
BubleSort() , sizeArray, , sizeDataArray. , BubleSort() dataArray. printArrayFunction() ArrayIntegerInputFunction(). , . , .
, , . , . , .
. , . .
Such processing is faster and has less computational complexity. C code is presented in a graphical application.
It is also made in the form of a function, in which the name of the array in need of ordering and the size of the array are passed as arguments. Here you can see how slow bubble sorting is. Inlays, similar work is much faster and has compact program code.