Traversal of binary tree
preface:
·The depth first traversal and width first traversal of binary tree are the basis for solving the problem of binary tree. Mastering the common traversal methods of binary tree can make us solve the problem of binary tree more handy.
catalogue
preface:
Recursive form of pre -, middle - and post order traversal of binar ...
Added by webpals on Tue, 01 Feb 2022 11:52:55 +0200
[daily question] sliding window + depth search + bit operation - Happy race week and happy New Year
⭐ New pit in winter vacation -- daily question notes of code Fox
5993. Multiply the value found by 2-week question 1
Give you an integer array nums, and give you an integer original, which is the first number to search in nums.
Next, you need to follow the following steps:
If the original is found in nums, multiply the original by 2 to g ...
Added by doctor_james on Tue, 01 Feb 2022 08:57:33 +0200
(java based) algorithm notes - Search Algorithm
Simple learning notes of search algorithm
1. Algorithm interpretation
Common first search algorithms: depth first search (DFS) and breadth first search (BFS), which are widely searched in structures such as graphs and trees
Summary:
DFS is to catch a matching element and recurse wildly until it does not meet the conditions, requiring auxili ...
Added by ArizonaJohn on Tue, 01 Feb 2022 08:17:18 +0200
Li Kou Day20 (happy New Year's Eve)
344,Reverse string
Write a function that inverts the input string. The input string is given as a character array s.
Do not allocate additional space to another array. You must modify the input array in place and use the additional space of O(1) to solve this problem.
class Solution {
public void reverseString(char[] s) {
...
Added by toibs on Tue, 01 Feb 2022 08:13:59 +0200
Sword finger Offer 41 Median in data stream
Sword finger Offer 41 Median in data stream
It's really a difficult question 😂, It's really a little difficult. At first, I thought it was violent. I always use sort every time I ask for mid, but as we all know, the time complexity of sort is \ (O(nlogn) \), and it will call mid multiple times, so this method is not used here.
In addition, yo ...
Added by winggundamth on Tue, 01 Feb 2022 03:52:50 +0200
Educational Codeforces Round 110 (Div. 2)
Question C is really a little thrilling. It's almost 1:57. There are only three or four minutes left
A. Fair Playoff
meaning of the title
Give the ability values of a,b, C and D, and then a,b, C and D. the winner will enter the finals. Ask whether the two players in the finals have the greatest ability. Is it fair or not analysis
Well, yo ...
Added by McMaster on Tue, 01 Feb 2022 02:17:52 +0200
Notes on the general algorithm for the sum of Leecode K numbers (taking the sum of four numbers as an example)
Sum of K numbers
Title Description: give you an array composed of any N numbers. Given a target value target, it is required to find K numbers so that the sum of these K numbers is target. It is required to output the combination of all k digits that meet this condition, and the combination shall not be repeated
(take K=4 as an example)
I ...
Added by knobby2k on Tue, 01 Feb 2022 00:45:07 +0200
Sorting of data structures
Sorting concept
Before sorting, you should first introduce some concepts of sorting:
Sorting: it refers to the ascending or descending arrangement of a string of records according to the size of one or some keywords. Stability: it is assumed that there are multiple records with the same keyword in the record sequence to be sorted. If they ...
Added by jorje on Tue, 01 Feb 2022 00:20:00 +0200
Segment tree of advanced data structure
Segment tree of advanced data structure
1. Prefix and
Given an array arr, the array can be very large. During the running of the program, you may have to do several query and update operations: query(arr, L, R) means to calculate the sum of all numbers from subscript L to subscript r in the array arr. update(arr, i, val) means to change the n ...
Added by Xoom3r on Mon, 31 Jan 2022 23:16:45 +0200
Arbitrary queen number problem (cpp)
catalogue
1, Understand the background of the eight queens problem (the eight queens problem Baidu Encyclopedia)
2, General idea
3, Analyze key details
IV. labeling
1, Understand the background of the eight queens problem( Eight queens problem_ Baidu Encyclopedia)
in short:
At 8 × Eight queens are placed on the 8-grid chess so tha ...
Added by zarp on Mon, 31 Jan 2022 22:37:22 +0200