Understand the sorting algorithm at one time, and summarize the commonly used sorting algorithms

preface Today, I will summarize the sorting algorithm often asked in the school recruitment interview. If you think the article is good, I hope you can like it and see it again. Thank you! There are benefits at the end of the article. Remember to check it~ Pre knowledge Stability of sorting algorithm The stability of the sorting algorithm r ...

Posted by HDMICable on Tue, 08 Feb 2022 22:23:02 +0100

Swordfinger offer 5 - Search Algorithm

Number of occurrences of number 53 in ascending array Given a non-descending array of length n and a non-negative integer k, it is required to count the number of times K occurs in the array Requirements: Spatial Complexity O(1), Time Complexity O(logn) Ideas: dichotomy. 1.mid=array.length/2; Divided into [0,mid] [mid+1;length-1] If (array[m ...

Posted by gmccague on Tue, 08 Feb 2022 21:56:25 +0100

Factorial sum (binary enumeration, dfs enumeration)

3481. Sum of factorials Question Restatement: Given a non negative integer n, please judge whether there are some integers Xi, which can make n = ∑ 1 ≤ i ≤ txi!, Where t ≥ 1,xi ≥ 0, xi = XJ, IFF i = J. iff means if and only if. Input format The input contains multiple sets of test data. Each group of data occupies one row ...

Posted by PhilVaz on Tue, 08 Feb 2022 18:14:41 +0100

Xinao 1215: maze (explain the restoration of tag array in detail)

1215: Maze Time limit: 1000 ms memory limit: 65536 KB [Title Description] One day, while exploring in the forest, extende accidentally walked into a maze, which can be seen as a maze by n × n Each grid point has only two states And #, the former means passable, and the latter means impassable. At the same time, when extend is at A ...

Posted by t31os on Tue, 08 Feb 2022 17:34:13 +0100

Flood Fill algorithm of common algorithm

Flood Fill algorithm of common algorithm Algorithm Introduction Basic function: find connected blocksBasic method: BFS searchApplicable topics: it is necessary to find out the topics of classification blocks / some clustering problemsAs the name suggests, Flood Fill algorithm is to find the surrounding qualified areas like flooding. BFS can b ...

Posted by DepretioN on Tue, 08 Feb 2022 15:44:16 +0100

Understanding and summary of red black tree

Copyright notice: This article is the original article of CSDN blogger "Zhang Yanfeng ZYF", which follows the CC 4.0 BY-SA copyright agreement. For reprint, please attach the original source link and this notice. Original link: https://blog.csdn.net/xiaofeng10330111/article/details/106080394 catalogue 1, Basic understanding ...

Posted by GeXus on Tue, 08 Feb 2022 15:36:53 +0100

[LeetCode] record of the 71st biweekly competition

Time: 22:30-24:00, February 5, 2022 Address: Competition - leetcode Outcome: 5984. Minimum sum of the last four digits after splitting Difficulty: simple I'll give you a four digit , positive integer , num. Please use the , digit in , num , and split , num , into two new integers , new1 , and , new2. New1 , and , new2 , ca ...

Posted by Mel on Tue, 08 Feb 2022 14:46:16 +0100

Interviewer: you don't even know how to restore the binary tree?

Recover the binary tree according to traversal In the knowledge of binary tree, finding or traversing binary tree is a very important knowledge point. Because the author only paid attention to the traversal process of binary tree before, but ignored the importance of the inverse process of recovering binary tree from traversal. When I saw an a ...

Posted by jarriola on Tue, 08 Feb 2022 10:29:10 +0100

Depth first search pruning (jisuanke - Lanqiao cup national competition training camp)

Depth first search pruning We have learned that the search process will eventually generate a search tree. Pruning, as the name suggests, is to cut down unnecessary subtrees on the search tree through some judgment. Sometimes, we will find that the state of the subtree corresponding to a node is not the result we want, so we don't need to ...

Posted by dch27 on Tue, 08 Feb 2022 10:16:39 +0100

[Codeforces] the abundance of Codeforces [partial explanation]

Abundance of Codeforces [by_041] Codeforces Round #721 (Div. 2) Codeforces Round #721 (Div. 2) A. And Then There Were K Problem - A - Codeforces The meaning of the question is to seek satisfaction[ n & ( n ...

Posted by tready29483 on Tue, 08 Feb 2022 07:54:43 +0100