Binary search tree

Binary search tree concept Binary search tree, also known as binary sort tree, is either an empty tree or a binary tree with the following properties: If its left subtree is not empty, the value of all nodes on the left subtree is less than that of the root nodeIf its right subtree is not empty, the value of all nodes on the right subtree is ...

Added by geoffjb on Thu, 03 Feb 2022 11:10:36 +0200

Using Rand to construct rand(10)

Title: if there is a function rand(0,7) - take a natural number randomly from 0 to 7, ask how to use this function to construct rand(0,10) - take a natural number randomly from 0 to 10. PS: this topic is implemented on the premise that rand(10) has no ready-made function. It must be constructed through rand(7) (Note: pay attention to the dist ...

Added by jeffduck on Thu, 03 Feb 2022 10:44:00 +0200

On the boundary problem of dichotomy and two writing methods

On the boundary problem of dichotomy and two writing methods We are familiar with the binary search method. For an ordered sequence, we can use the binary search method in O ( l o g N ...

Added by devioustree on Thu, 03 Feb 2022 10:10:44 +0200

Variety of Digits (dp)

Variety of Digits [Link](F - Variety of Digits (atcoder.jp)) meaning of the title Give you a number n n n. And m m m single digits, ask 1 ...

Added by VenusJ on Thu, 03 Feb 2022 09:28:36 +0200

2019 Nanjing railway station (Revisiting the Classics)

Introduction Knowledge points involved Thinking, multiplicative inverse, combinatorial mathematics, topological sorting, DP, bipartite graph, maximum weight matching, plane geometry Link: Nanjing 2019 regional competition [Cloned] subject A Give a positive integer n and find the smallest integer k to make the set ...

Added by sirfartalot on Thu, 03 Feb 2022 08:36:31 +0200

Algorithm design and analysis Manacher algorithm

Problem description Problems solved by Manacher algorithm: (1) How to solve the length of the longest palindrome substring in string str (2) How to achieve time complexity O(N)? Conventional thinking Traverse each character, regard each character as a center (axis of symmetry), and expand to the left and right respectively. The same will ...

Added by josa on Thu, 03 Feb 2022 07:48:17 +0200

Luogu P2888 [USACO07NOV]Cow Hurdles S problem solution

Luogu P2888 [USACO07NOV]Cow Hurdles S problem solution Title Link: P2888 [USACO07NOV]Cow Hurdles S Farmer John wants her cows ready for the county jump race. Bessie and her partners are practicing hurdles. They are very tired, so they want to use the least energy to cross the hurdles. Obviously, it is easy for a cow to jump over several lo ...

Added by steonkeys on Thu, 03 Feb 2022 05:52:58 +0200

STL database review

Happy New Year! The first blog in 2022 is mainly because I don't like summarizing, so I need to read more and summarize more. Then it's today's review! 1.vector vector<int>a; a.push_back(); a.pop_back(); a.insert(a.begin() + i, k);//Insert from position i for (vector<int>::iterator i = a.begin(); i != a.end(); i++) { cout ...

Added by binujayaraj on Thu, 03 Feb 2022 05:52:23 +0200

0x11 content introduction and example exercises

The basic characteristics of stack will not be repeated here. Focus on stack related applications and related exercises. Stack and Cartland sequence I will introduce the catteland sequence in detail in section 0x36. [example] in and out stack sequence problem (AcWing130) Title Link Idea: after careful observation, we will find that the ...

Added by SWD on Thu, 03 Feb 2022 05:05:55 +0200

Algorithm problem summary

catalogue 1. Mystery of the future thinking Code display 2. Don't be distracted thinking Code display 3. River crossing pawn thinking Code display 4. Carpet thinking Code display 5. Minimum new integer thinking Code display 6. Astronauts thinking Code display 1. Mystery of the future /**In 2022, Mike found two binary i ...

Added by artfuldrone on Thu, 03 Feb 2022 03:51:58 +0200