Tree array: 1D + 2D
Some content sources: bestsort blog
Recommended blog: CSDN: Nangong Yichen - thoroughly understand the two-dimensional tree array CSDN: Lv1_kangdi - 2D tree array summary and template
The one-dimensional tree array sum[x] records the prefix and length of lowbit(x) from 1 to X
The two-dimensional tree array sum [x] [y] records the sum of area ...
Added by BooRadLey on Tue, 04 Jan 2022 06:41:27 +0200
Simple knowledge of bit operation
Simple knowledge of bit operation
Several points to remember in bit operation are:
If you want to go to the last place, use num% 2To remove the last bit, use num = num / 2If it is judged that a number is the power of 2, use (n & - n) = = n, which will be described in detail belowThe XOR of two identical numbers is 0, the XOR value of al ...
Added by desmortes on Tue, 04 Jan 2022 06:33:37 +0200
Data structure algorithm problem (C + +)
0 preparation
Online C + + running tool
How to use: copy the code in each question to the online running website above
Chapter 1: sequential representation of linear tables
01
Title: suppose the sequence table is not empty. Find the minimum value and its subscript from the sequence table and return it by reference
Idea:
① Application v ...
Added by BraniffNET on Tue, 04 Jan 2022 05:20:50 +0200
Liu Rujia - purple book chapter 7
7.1 simple enumeration
In fact, when simple enumeration can pass, don't think of the situation as so complex.
1.Example 7-1 division (UVA 725)
#include<cstdio>
#include<set>
using namespace std;
set<int> cnt;
int N;
int flag;
void solve()
{
int m = 98765 / N, j;
for(int i = 1234; i <= m; i++){
cnt.clear() ...
Added by Crazy-D on Tue, 04 Jan 2022 02:09:00 +0200
The fifth day of LeetCode (delete the penultimate node of the linked list)
Title Description
Give you a linked list, delete the penultimate node of the linked list, and return the head node of the linked list.
Advanced: can you try using one scan?
Example:
Input: head = [1,2,3,4,5], n = 2
Output:[1,2,3,5]
Input: head = [1], n = 1
Output:[]
Input: head = [1,2], n = 1
Output:[1]
preface
When operating th ...
Added by squiblo on Mon, 03 Jan 2022 23:58:00 +0200
Algorithm and data structure foundation < 4 > ---- dynamic data structure foundation of data structure foundation: linked list < 2 >
Linked list and recursion:
Last time Algorithm and data structure foundation < 4 > -- dynamic data structure foundation of data structure foundation: linked list < medium > We have made a preliminary study of recursion. At the end of the paper, it is mentioned that we must understand the macro semantics of recursion when writing th ...
Added by thz_new_york on Mon, 03 Jan 2022 23:27:45 +0200
Principle and implementation of efficient data type - jump table Java version
This article focuses on the implementation. The first contact with the data structure of jump table was in Redis. At that time, I only learned the theoretical knowledge of jump table, which is difficult to support by theory alone. This can be realized when I was asked about jump table in the process of byte interview
Jump table is a very high- ...
Added by valen53 on Mon, 03 Jan 2022 20:02:39 +0200
A * introduction to path search algorithm and complete code
1. Introduction
A* (A-Star) algorithm is a solution in static road network Shortest path One of the most effective methods is a commonly used heuristic algorithm
Heuristic algorithm: calculate the key value through heuristic function to guide the search direction of the algorithm
2. Algorithm description
Ray Wenderlich - Introduction to A* ...
Added by echoninja on Mon, 03 Jan 2022 16:46:58 +0200
Blue Bridge Cup basic practice Java
01 A+B question (simple)
Resource constraints Time limit: 1.0s memory limit: 256.0MB Problem description Input A, B, output A+B. Input format The first line of input consists of two integers separated by spaces, representing A and B respectively. Output format Output a line, including an integer, representing the value of A+B. sample input ...
Added by scrupul0us on Mon, 03 Jan 2022 14:24:52 +0200
Responsibility chain model
In real life, it is a common scene that an event needs to be processed by multiple objects. For example, purchase approval process, leave process, etc. When the company's employees ask for leave, the leaders who can approve the leave include department heads, deputy general managers, general managers, etc., but the number of days each leader ca ...
Added by TWD on Mon, 03 Jan 2022 12:37:03 +0200