Sword finger Offer 09. Queue with two stacks

Sword finger Offer 09. Queue with two stacks Title Description: Implement a queue with two stacks. The declaration of the queue is as follows. Please implement its two functions appendTail and deleteHead to insert integers at the end of the queue and delete integers at the head of the queue respectively. (if there are no elements in the queue, ...

Posted by Mardoxx on Fri, 19 Nov 2021 20:09:11 +0100

pthread Queue for thread synchronization

pthread Queue for thread synchronization Original link https://www.foxzzz.com/queue-with-thread-synchronization/ In recent days, pthread needs to be used to implement a Queue with thread synchronization function. In the process, two pits are stepped on: pthread_cond_wait() needs to be placed in pthread_mutex_lock() and pthread_mutex_unlock( ...

Posted by mrwutang on Fri, 19 Nov 2021 18:04:14 +0100

Modern writing of C++ string

1, Modern writing implementation interface The first is the realization of modern writing method of copy construction: string_str(const string_str& st) :str(nullptr) { string_str tem(st.str); swap(this->str, tem.str); First, set this - > STR to null, then temp calls the constructor and initializes this - > STR wit ...

Posted by Syrehn on Thu, 18 Nov 2021 16:10:22 +0100

cout formatted output

    Sometimes, we want the output content to be output in the format we specify.     For example, when outputting a floating-point number, we want to keep two digits after the decimal point; When outputting an integer, you want it to be 8 numbers When the width is insufficient, fill 0 on the ...

Posted by cac_azure03 on Thu, 18 Nov 2021 03:49:59 +0100

C + + template class and smart pointer

catalogue 1, Experimental content 2, Experimental process 1. Template function 1.1 general template functions 1.2 specialized template function   2. Class template Queue Type 2.1 formwork 2.2 member template function 2.3 formwork specialization 3. Template smart pointer 3.1 smart pointer 3.2 constructor 3.3 destructor   ...

Posted by amclean on Wed, 17 Nov 2021 17:09:18 +0100

htm static page reading script based on C + +

I wrote a script for hxd the other day, because I haven't had time for the exam these days. After the exam, I took the time to share it. Requirement: automatically crawl some field values of the static htm page and put them into the excel table. For example, a static page of someone's final exam results needs to automatically import tens of tho ...

Posted by easmith on Wed, 17 Nov 2021 12:06:26 +0100

[Opencv uninstall and reinstall] under NVIDIA Xavier NX, uninstall opencv3 and reinstall opencv4

preface Due to the requirements for OpenCV version, you need to uninstall OpenCV3.4 and reinstall version 4.4.0. Note: ROS originally had its own OpenCV. Remember not to delete it, but only delete your own additional library, otherwise some function packages in ROS will collapse because you can't find the original OpenCV. I can't find ...

Posted by ankhmor on Wed, 17 Nov 2021 11:09:55 +0100

LIO-SAM: replace Euler angle with SO3 in the solution process of Gauss Newton method

Leo-sam, published in IROS2020, is a very effective inertial laser tightly coupled odometerI'm going to get a laser odometer for our robot, so I'm going to change LIO-SAM and get itA problem is found in the modification process: in the process of odometer solution (LMOptimization function of mapOptimization), the author uses Euler angle to repr ...

Posted by dnamroud on Wed, 17 Nov 2021 06:37:26 +0100

November 12, 2021 (2018 CCPC Jilin station)

A - The Fool Meaning: For a number n, you need to find the sum of n/1+n/2+...+n/n, judge whether the sum is odd or even, and output. Idea:   It can be found that the first three numbers are odd, five are even, seven are odd and nine are even, that is, the equal difference sequence with tolerance of 2. It can be found that 3,5,7,9, and ...

Posted by sumeet on Tue, 16 Nov 2021 09:49:39 +0100

Simplify QThread and UI synchronization with lambda

Used to C# and JAVA, I found it inconvenient to use QT again. We can't say who is better. At least some places can learn from and complement each other, such as the use of threads. There are threads and tasks in C# to create background Task threads. There are threads and Runnable in JAVA, but it is relatively troublesome in QT, or at least the ...

Posted by amesowe on Sat, 13 Nov 2021 04:22:40 +0100