Thinking in C + +: STL algorithm
Thinking in C + + > STL algorithm summary notes.
STL algorithm directory
0. Algorithm overview
fill(), assign value to each element of [first, last].fill_n(), n elements starting from first are assigned value.generate(), use the generator to generate a value for each element of [first, last].generate_n() generates a value for the n el ...
Posted by Gayner on Tue, 25 Jan 2022 07:28:40 +0100
[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "deleting duplicates in ordered arrays"
1, Title Requirements
Give you an ordered array nums, please delete the repeated elements in place, make each element appear only once, and return the new length of the deleted array.Do not use additional array space. You must modify the input array in place and complete it with O(1) additional space.explain:
Why is the returned value an in ...
Posted by priya_amb on Tue, 25 Jan 2022 05:27:06 +0100
Binary tree recursive routine: judge whether it is a full binary tree and the number of nodes of the largest sub search binary tree
Today, continue the recursive routine of binary tree.1, Determine whether it is a full binary treeFull binary tree definition: for a binary tree with height h, the number of nodes is (2^h - 1)1. Recursive routine ideaAccording to the definition of full binary tree, we only need to obtain the height and the number of nodes each time.That is, we ...
Posted by elementaluk on Tue, 25 Jan 2022 04:46:06 +0100
Solution to the eighth Blue Bridge Cup B. arithmetic prime sequence
quote
fund Arithmetic prime sequence
Wake up at night Arithmetic prime sequence
tremble
At first, I didn't understand. I actually wanted to use dfs to list the equal difference sequence one by one. Suddenly, I thought, this is not very realistic. First of all, you don't know where the starting position is. Secondly, you don't know the toler ...
Posted by Seas.Comander on Tue, 25 Jan 2022 03:42:47 +0100
[stetch cup · Cloud Bridge · algorithm training camp] week 3
1. Fibonacci sequence Title Description Fibonacci numbers are usually represented by F(n), and the sequence formed is called Fibonacci sequence. The sequence starts with 1 and 1, and each subsequent number is the sum of the first two numbers. That is:
F(0) = 1,F(1) = 1 F(n) = F(n - 1) + F(n - 2), where n > 1 Here you are n, please calculat ...
Posted by cap2cap10 on Tue, 25 Jan 2022 03:11:20 +0100
Structure - who won the most scholarships?
Don't say anything else, give me the scholarship first
analysis
Understanding: we can understand it as a template, but at the same time, we can regard it as a user-defined type, just like int, short and char. The class we learned later is actually very similar in structure to struct.
Struct is a keyword, and the structure name after struct i ...
Posted by rubio on Tue, 25 Jan 2022 00:07:26 +0100
Learning of math, fmt, io basic package
1, math
Provides basic constants and mathematical functions
1. Absolute value of number
func Abs(x float64 ) float64
exceptional case
Abs(±Inf) = +Inf
Abs(NaN) = NaN
2.func Cbrt(x float64 ) float64
func Cbrt(x float64 ) float64
3.Floor returns the maximum integer value less than or equal to x.
func Floor(x float64 ) float64
4.Ceil r ...
Posted by Disgrntld on Mon, 24 Jan 2022 23:07:56 +0100
Yiwen church 01 Backpack
01 Backpack
01 backpack refers to a topic template
If there are many things, each thing can only be loaded into a backpack once, and the backpack has an upper volume limit
This is the classic 01 knapsack problem
When we subconsciously recite the template
Let's first think about the violent solution to the 01 knapsack problem
In the 01 bac ...
Posted by kate_rose on Mon, 24 Jan 2022 21:49:08 +0100
Algorithm 06 - patA1016 telephone bill problem (pairing sorting and summation)
Title Description: give the charge (cents/minute) of each hour interval in 24h, and give N call recording points. Each call recording point records the name, current time (month: Day: hour: minute) and whether it belongs to on-line or off-line. Now it is necessary to calculate the tariff of each person's effective call records. Eff ...
Posted by robvan75 on Mon, 24 Jan 2022 21:41:14 +0100
Algorithm -- LeetCode 468 Verify IP address
1. Title
Original question link
Write a function to verify whether the input string is a valid IPv4 or IPv6 address.
If it is a valid IPv4 address, return "IPv4"; If it is a valid IPv6 address, return "IPv6"; "Neither" is returned if the IP address is not of the above type.
IPv4 addresses are represented by dec ...
Posted by Shuriken1 on Mon, 24 Jan 2022 20:10:41 +0100