Morris, recursive binary tree before, during and after traversal
Experiment time: 11.10
catalogue
Generating complete binary tree
Implementation of Morris algorithm
Introduction to morris traversal
Implementation principle of morris traversal
The essence of morris traversal
Briefly describe the algorithm process
Recursive implementation
Experimental results (including time, space and output results) ...
Posted by defeated on Sun, 21 Nov 2021 13:58:54 -0800
Data structure_ Thoroughly understand the tree notes
1, Definition of tree
A finite set composed of n (n > 0) nodes is an empty tree when n is equal to zero For any non empty tree, it has the following properties: 1. There is a special node in the tree that becomes the root, which is represented by r 2. Other nodes can be divided into m (M > 0) disjoint finite sets T1.T2.T3... Tm, in w ...
Posted by sitorush on Sun, 21 Nov 2021 11:24:57 -0800
Greedy algorithm C++ puzzle (leetcode101 (biscuit allocation 455 (candy allocation 135) (interval problem 435)
Basic Ideas: Local Optimal - >Global Optimal Difficulty: Determine the best "what object"
Simple questions:
Find money: a total of x Yuan with a minimum of several pieces of money 100 yuan 50 yuan 10 yuan 5 yuan 1 yuan Idea: x divides 100, 50, 20, 10, 5, 1 Integer division adds up
leetcode
455 Allocate cookies
Suppose you're a ...
Posted by amreiff on Sun, 21 Nov 2021 10:53:40 -0800
2021-09-12 algorithm Fourth Edition: 1.1.27 binomial distribution, from 10 to 10 billion
Algorithm Fourth Edition: 1.1.27 binomial distribution, from 10 to 10 billion@ TOC
Recursive method to realize binomial distribution operation, O(2^N)
The recursive algorithm is relatively simple. It is very suitable for small parameters.
But the problem is also obvious. N * k > 100 is very slow at the beginning. When > 1000, the progr ...
Posted by Tazerenix on Sun, 21 Nov 2021 02:13:00 -0800
Daily question: 600. Non negative integers without continuous 1
Title:
Given a positive integer n, find a non negative integer less than or equal to n whose binary representation does not contain Continuous 1 Number of.
Example 1:
Input: 5 Output: 5 Explanation: The following is a nonnegative integer < = 5 with the corresponding binary representation: 0 : 0 1 : 1 2 : 10 3 : 11 4 : ...
Posted by Quilmes on Sun, 21 Nov 2021 02:01:15 -0800
std::thread join() function of multithreading
C++11 introduces the function std::thread join(), which is used to wait for a thread to complete its task. Let's take a step-by-step look at this function.
In a simple program, only one thread is required, that is, the main thread:
int main()
{
cout << "The main thread starts running\n";
}
Now suppose I have to do a time-consuming ...
Posted by Steffen on Sun, 21 Nov 2021 01:32:56 -0800
Minimum spanning tree of graph (implementation and explanation of prim algorithm and kruskal algorithm)
catalogue
1. Topic introduction
Let's start with the topic , It is convenient to understand and reflect the algorithm more intuitively
2. Introduce my understanding of the implementation of prim algorithm code in books
1. Function of lowcast array
2. Function of adjvex array
3.kruskal algorithm
3. If you want the sou ...
Posted by rpanning on Sat, 20 Nov 2021 21:24:35 -0800
(vscode) C + +, SFML write game applet ----- note1
Call the SFML class and draw several small shapes to the window. (window class, shape class)
#include <SFML/Graphics.hpp>
int main()
{
//create a window
sf::RenderWindow window(sf::VideoMode(640, 480), "SFML Application");
//create a circle shape
sf::CircleShape cShape;
cShape.setRadius(40.f);
cShape.set ...
Posted by randydg on Sat, 20 Nov 2021 17:52:15 -0800
Longest substring without repeated characters (C + + problem solution, including VS runnable source code)
1. Force buckle C + + source code
class Solution {
public:
int lengthOfLongestSubstring(string s) {
map<char, int> hash;
int ans = 0;
int i = 0;
int n = s.length();
for (int j = 0; j < n; j++) {
if (hash.find(s[j]) != hash.end()) {
i = max(hash.find(s[j])-> ...
Posted by ShaolinF on Sat, 20 Nov 2021 13:24:24 -0800
[HBU-DS] 7-5 tribes (and search Collection)
7-5 tribes (20 points)
subject
In a community, everyone has his own small circle and may belong to many different circles of friends at the same time. We think that all friends of friends are in one tribe, so please count how many disjoint tribes there are in a given community? And check whether any two people belong to the same tribe.
Input ...
Posted by delorian on Sat, 20 Nov 2021 11:29:49 -0800