Day13. Sliding window maximum value, top K high frequency elements

Day13. Sliding window maximum value, top K high frequency elements 0239. Sliding window maximum Link: 0239. Sliding window maximum Monotonic queue: The queue is monotonic. In order to maintain this monotonicity, when adding elements to the tail of the queue, if the previous element and the current element do not satisfy the monotonic relatio ...

Posted by papacostas on Thu, 10 Nov 2022 19:11:56 +0300

Building trees by weight, plane geometry

14 Day Reading Challenge  MEX vs MED  It can be found that only when the median in the series is equal toWhen the condition is met, that is, the numbers before the median must also be in the sequence, then we can enumerate from 0~n-1, and use l and r to indicate the occurrence of the first i number According to the above formula, it can be se ...

Posted by tryingtolearn on Thu, 20 Oct 2022 18:28:00 +0300

[C++ Search Binary Tree] 1. The concept of binary search tree 2. Non-recursive implementation of binary search tree

Table of contents 1. Binary search tree concept 2. Non-recursive implementation of binary search tree 2.3 Search for deletion of binary tree (the most important and most difficult interface) 3.(key) recursive implementation of binary search tree 4.(KV) recursive implementation of binary search tree 1. Binary search tree concept A sear ...

Posted by rutin on Wed, 19 Oct 2022 15:57:05 +0300

Thread pool based on modern C++ implementation

Why do you need a thread pool? The thread pool is one of the components of a multithreaded program For a program, we want to take advantage of the multi-core performance as much as possible At this time, we need multi-threading or multi-process to squeeze the performance of the CPU. But multi-process communication is really more expensive, ...

Posted by IceRegent on Tue, 11 Oct 2022 05:58:01 +0300

2022 CCPC Henan Province Competition (A,E,F,G,H)

better reading experience \color{red}{Better reading experience} better reading experience A. Mocha is in small classes Original title link Topic meaning: a number that differs from each other ...

Posted by chamade76 on Fri, 07 Oct 2022 21:51:05 +0300

A detailed explanation of C++ operator overloading

First, the basic concept of operator overloading  Operator overloading is to redefine an existing operator and give it another function to adapt to different data types (operator overloading cannot change the original meaning. It cannot change the meaning of the underlying type) Operator overloading is just a syntactic convenience, i ...

Posted by rdhatt on Fri, 07 Oct 2022 11:27:09 +0300

Topk algorithm_topn algorithm

Hello everyone, meet again, I am your friend Quanzhanjun.topK algorithmIdea 1: Quick Selection Algorithm The fast selection algorithm can be used. With the help of quick sorting, let mid be the intermediate result of each division. After each division, if mid==k, it means that the sequence is just right, and the k th position and the position ...

Posted by madhu on Wed, 21 Sep 2022 21:47:35 +0300

CF Round 812 F. Lost Array

F. Lost Array I spent many hours fooling around yesterday, reading the wrong questions and reading the wrong code. Finally, I got out of the mess. I wrote a blog to record the mentality of nearly breaking the computer yesterday Observe the mysterious code of others and find the following mysterious properties For ordered column subset XOR, ...

Posted by Sillysoft on Thu, 15 Sep 2022 21:16:40 +0300

Derivation of C++ decltype type

decltype specifier (C++11) C++11 introduces a decltype specifier, which can obtain the type of an object or expression. It is also easy to use: #include <iostream> int main() { int x1 = 0; decltype(x1) x2 = 0; // x2 is derived as int type (type of variable x1) std::cout << typeid(x2).name() << s ...

Posted by bimbo on Wed, 07 Sep 2022 22:08:45 +0300

System Programming (I/O)

How Ubunt u implements the cp function ps: copy the content of one file to another file, test: text, image, video #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> int main(int argc, char*argv[]) { if(argc<3) { printf("Missin ...

Posted by dsp77 on Sun, 04 Sep 2022 08:27:48 +0300