C # direct insertion sorting
Basic Idea: insert the size of the key code of the record to be sorted in sequence to the appropriate position of the sorted record subsequence. The number of records in the subsequence increases from 1. When the number of records in the subsequence is in the first order, the number of records in the table is sorted at the same time.
C # Insert the Sorting Code directly:
- ///<Summary>
- /// Insert the sorting algorithm directly
- /// Summary>
- PublicclassDirectInsertSort: IAction
- {
-
- # RegionIAction Member
-
- PublicvoidAction ()
- {
- Int []Array=Program. RandomArray ();
- For (Inti=1; I<Array. Length; I ++)
- {
- If (array [I]<Array[I-1])
- {
- Inttem=Array[I];
- Intj=0;
- For (J=I-1; j>= 0 & tem<Array[J]; j --)
- {
- Array [j + 1] = array [j];
- }
- Array [j + 1] = tem;
- }
- }
- }
- # Endregion
- }
The preceding section describes how to directly insert and sort data in C.
- C # Call Windows API functions
- C # Calling Outlook APIs
- C # connect to Access and SQL Server databases
- Introduction to C # API call problems
- C # Call Excel and additional code