Round robin schedule
There are n players to play a tennis round robin. Design a competition schedule that meets the following criteria:
Each player must play n − 1 other players once each;
Each player can only race once a day;
When n is even, the round robin is played for n − 1 days.
When n is odd, the round robin is played for n days.
Posted on Data Structure and Algorithm
Insert Sort, Merge Sort and Quick Sort
IntroductionInsert Sort AlgorithmStraight Insertion Sort:
Think of n elements to be sorted as an ordered table and an unordered table. At the beginning, the ordered table contains only 1 element, while the unordered table contains n-1 elements. In the sorting process, the first element is taken out of the unordered table every time and inserted into the appropriate position in the ordered table to make it a new ordered table. Repeat n-1 times to complete the sorting process.
What we should do:
Take the first number in the disordered region and find its corresponding position in the ordered region.
Insert the data in the unordered region into the ordered region; If necessary, the relevant data in the ordered region is shifted.
Posted on Data Structure and Algorithm