Merge sort and its extension

Merge sort Before learning merge sort, let's consider how to find the maximum value of an array? Our first thought is to traverse the array, compare the size and record the maximum value, but what if we want to use recursive implementation? We can divide the array into two parts of equal length, find the maximum values on both sides, finally t ...

Posted on Fri, 26 Nov 2021 19:52:16 -0500 by phpcodec

Sorting -- two-dimensional ring equally divided cards -- Tanabata Festival

Problem description Tanabata Festival has been labeled "Valentine's Day" because of the legend of Cowherd and weaver girl. So TYVJ held an offline Tanabata Festival this year. Vani successfully invited cl to spend Tanabata with him this year, so they decided to go to TYVJ Tanabata Festival. 　　 TYVJ Tanabata Festival is very sim ...

Posted on Fri, 24 Sep 2021 22:10:28 -0400 by pas07920

Zero foundation to quickly master JavaScript array, deep copy and shallow copy

catalogue 1, Array basis 1. Create an array 1. Use Array constructor to create 2. Use literal method to create 3. Application: create an array containing 1-100   2. Array traversal Two ways f (for, for in loop) of traversal 2, The array realizes deep copy and shallow copy 1. Deep copy and shallow copy 2. Deep copy and shallow c ...

Posted on Mon, 20 Sep 2021 16:31:27 -0400 by sogno

C # implements various sorting algorithms

C # implements various sorts Key points and implementation of each sort In this article, the parameter func < T, t, bool > comp means that there can be no comp(list[j], list[i]) for any I < J after sorting Bubble sorting Each cycle puts the maximum value to the front or lastReverse order, only need to access list.Count once (op ...

Posted on Sat, 11 Sep 2021 14:14:12 -0400 by djumaka

Top ten sorting (quick sort, count sort, bucket sort, cardinal sort)

1, Quick sort Through one-time sorting, the data to be sorted is divided into two independent parts. All data in one part is smaller than all data in the other part, and then the two parts of data are sorted quickly according to this method. The whole sorting process can be recursive, so that the whole data becomes an ordered sequence. Algori ...

Posted on Sun, 05 Sep 2021 01:34:03 -0400 by HuggyBear