Depth first traversal of numbers and graphs & breadth first traversal of trees and graphs
Depth first traversal of trees and graphs & breadth first traversal of trees and graphs
The two traversal methods of tree and graph are algorithms based on the idea of dfs and bfs. Its idea is still recursive, but the traversal object becomes an undirected graph, so there are more precautions in the process of graph construction and sea ...
Posted by Dia:NL on Mon, 14 Feb 2022 11:56:29 +0100
Selected algorithm problem -- odd and even data separation
Author: Zhai Tianbao Steven Copyright notice: the copyright belongs to the author. For commercial reprint, please contact the author for authorization. For non-commercial reprint, please indicate the source
Title Description:
Input an integer array and implement a function to adjust the order of numbers in the array, so that all odd numbers a ...
Posted by Nulletz on Mon, 14 Feb 2022 10:03:52 +0100
1008 circular right shift of array elements
Novice Xiaobai is here again. Write a blog to record his problem making process.
I find that blogging will make me more motivated to do questions. Now it's a holiday. I write about two or three questions every day. I hope I can stick to it after school starts. I don't say two or three questions every day. I wish I could stick to one question e ...
Posted by staggman on Mon, 14 Feb 2022 09:23:42 +0100
Pointer-Pointer Array, Array Pointer
Part1:
Pointer Array Usage Low-level Write Output Normal
Earlier, pointer arrays were mentioned as arrays, which hold pointers. Why does this happen? When we want to give many addresses to a pointer variable, we need a write, which is too cumbersome. The pointer array solves this problem. Take a look at the use of pointer arrays: and definin ...
Posted by subcool on Sun, 13 Feb 2022 18:21:06 +0100
SDL2 + OPENGL GLSL practice (Continued)
The content of this article includes: the implementation of freetype Chinese character display, the use of GLSL, including the use skills of slice shader, texture mixing, transparent display method, texture sampling method, etc., vertex shader, common transformation skills, image enlargement, image reduction, image rotation, etc
Continued:
1, ...
Posted by ridgerunner on Sun, 13 Feb 2022 15:45:55 +0100
[STL source code analysis] summary note (12): Functors and adapters
00 in front
Functions and adapter s come to the last part of the whole STL. Although these two parts are not many, they can be said together.
But as the two major components of the six major components of STL, they still have many design essences, which deserve our learning.
This is also the last summary note of [STL source code analysis]. ...
Posted by jvalarta on Sun, 13 Feb 2022 12:10:01 +0100
Double pointer algorithm based on algorithm c++&python
The core of double pointer: transfer the information expressed by the previous state pointer to the next state, so as to reduce unnecessary search
Template:
while(i < n && j < m){ if(checked(i, j)) i ++; j ++; }
Topic 1:
Given a sequence of integers a1,a2,..., an with a length of nn and a sequence of integers b1 ...
Posted by ignace on Sun, 13 Feb 2022 10:37:24 +0100
Codeforces Global Round 19 A - E
https://codeforces.com/contest/1637
A
Select a length len, sort the number of the first len and the number of the next len respectively, and ask whether the array can always be arranged well
Obviously, only the array has been ordered before
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
ios::syn ...
Posted by webpals on Sun, 13 Feb 2022 10:33:58 +0100
Design mode_ 03 six design principles
Design mode_ 03 six design principles
Opening and closing principle
It is open to extensions and closed to modifications. Implemented through interfaces and abstract classes. Code implementation:
class Abstract_father {
public:
virtual void func() = 0;
};
class son1 : Abstract_father {
public:
void func() {
cout << "son1" < ...
Posted by hey_suburbia on Sun, 13 Feb 2022 09:29:43 +0100
Advanced depth first search
Depth first search application
Example 1: alphabetical arrangement (subject library 2698)
Given a string composed of different lowercase letters, output all the full permutations of the string. Let's assume 'a' < 'B' <... < 'for lowercase letters Y '<' Z ', and the letters in the given string have been arranged from small to large ...
Posted by captain_scarlet87 on Sun, 13 Feb 2022 09:04:28 +0100