*************** Ordinary bubble sorting method begin ********************
Void main () {Int num [] = {8, 6, 7, 5, 3, 4, 2, 1, 0, 9}, state = 1; for (int i = 0; (i <= 9) &&st ; i ) {state = 0; for (int J = 0; j <= 9-i; j ) IF (NUM [J]> NUM [J 1]) {INT TEMP = NUM [J]; Num [J ] = NUM [J 1]; NUM [J 1] = Temp; State = 1;}} for (i = 0; i <= 9; i ) cout << Num [i] << "
*************** Ordinary bubble sorting method over ********************
*************** Bubbling Sort Law (Link Meter Implementation) Begin **************
Typedef strunt node {int v; struct node * next;} node; void insert (node * l, int e) {node * temp = new node; temp-> v = E; TEMP-> Next = null; l-> Next = Temp;} void main () {node * h = new node, * l = new node, * p0 = new node, * p1 = new node; l = H; INSERT (h, 8); h = H- > Next; Insert (h, 6); h = h-> next; INSERT (h, 7); h = h-> next; insert (h, 5); h = h-> next; insert (h, 3 ); H = h-> next; insert (h, 4); h = h-> next; insert (h, 2); h = h-> next; INSERT (h, 1); h = H-> Next Insert (h, 0); h = h-> next; INSERT (h, 9); h = L; L = L-> Next; / * while (l! = Null) {printf ("% d", L-> V); L = L-> Next;} // Constructing the entire linked list // Implement the bubble method * / int State = 1, max = 100; // Set the value of MAX to 100, facilitating One round cycle for (p0 = h-> next; p0! = Null && stat; p0 = p0-> next) {state = 0; for (p1 = H-> next; p1-> next! = Null && p1-> v! = Max; p1 = p1-> Next) = (p1-> v)> (p1-> NEXT-> V)) {INT A; a = p1-> v; p1-> v = p1-> next-> v; p1-> next-> v = a; state = 1;} max = 0; for (p1 = h-> next; p1-> next! = null && p1-> v! = max; p1 = p1-> next ) // This cycle finds that the maximum value in this range assigns max if (p1-> v> max) max = p1-> v;} while (l! = Null) {printf ("% d", L -> v); l = l-> Next;}} ********* ******* Bubbling Sort Law (Link Table Implementation) OVER **************
Haha, I learned a little today, happy ING