Sorting is a very important data processing function. A large part of the work of computer system is sorting data. Therefore, how to sort the data efficiently is an important problem in all kinds of software. By describing the common sorting algorithm and summarizing its time complexity, space complexity and stability, this paper summarizes the applicable principles of sorting algorithm: when the scale of records is small, you can choose to directly insert sorting or directly select sorting; when the initial state of records is generally orderly, you should choose to directly insert sorting or bubble sorting; when the scale of records is large, you should choose to quickly arrange Order or merge sort; when records are in two ordered tables, merge sort is the best way to merge them into a new ordered table.