Some students may not have a concept of the speed of the computer, but feel that the computer should run very fast. Then why do they timeout when doing algorithm problems on LeetCode?
How many operations can a computer 1s perform? Next, let's explore this problem.
1. Reasons for timeout
Everyone should have encountered an error when pra ...
Posted by kol090 on Wed, 13 Apr 2022 08:51:51 +0300
Force buckle to find the median C + + Solution of two ordered arrays
1, Complete title
Give two positively ordered (from small to large) arrays nums1 and nums2 of sizes m and n, respectively. Please find and return the median of these two positive arrays. The time complexity of the algorithm should be O(log (m+n)).
Example 1: Input: nu ...
Posted by theycallmepj on Wed, 13 Apr 2022 06:50:28 +0300
Reading guide
Storing a string with a character array is prone to array out of bounds errors, and it is often difficult to detect. Therefore, the C + + standard template library has designed the string data type, which is specially used for string processing. String is not the basic data type of C + +. It is a "class" in the C + + st ...
Posted by crondeau on Wed, 13 Apr 2022 03:46:23 +0300
Determine whether it is a palindrome string
Palindrome string is a kind of string that is the same as the original one after reversing the pros and cons. Therefore, when determining whether a string is a palindrome string, we can judge as follows: (1) When the length of the string is odd, find the subscript in the middle and compare whether ...
Posted by Kurrel on Wed, 13 Apr 2022 02:57:14 +0300
C + + programs are sensitive to memory management and often have memory leakage bug s. At the same time, in order to quickly apply and release memory and reduce small memory fragments, most of them have memory management modules.
I added memory management in my own server framework, which is basically the set of STL library. For the memory les ...
Posted by JimChuD on Wed, 13 Apr 2022 02:38:20 +0300
[problem description]
Given an item set s = {1, 2, 3,..., n}, the weight of item i is wi, its value is vi, and the capacity of the backpack is w, that is, the maximum carrying capacity does not exceed W. Within the limited total weight W, how can we choose items to maximize the total value of items.
input
The first data is that the capa ...
Posted by wolfraider on Tue, 12 Apr 2022 21:06:02 +0300
😀 Hello, I'm Bai Chen. I'm not very able to stay up late 😫, But people who want to get better ✈. If you like this article, give it a compliment 👍, Pay attention 👀 Bai Chen! Your support is my biggest motivation! 💪💪💪
🏹 preface
Bai Chen reviewed my C + + learning journey during this period and found many bumps and difficulties. Ther ...
Posted by carrot on Tue, 12 Apr 2022 05:18:24 +0300
C++PrimerPlus Chapter 5 loop and relational expression (programming practice with answers)
1. Write a program that requires users to enter two integers. The program will calculate and output the sum of all integers between the two integers (including the two integers). It is assumed that a smaller integer is entered first. For example, if t ...
Posted by aseaofflames on Tue, 12 Apr 2022 05:08:48 +0300
1. General
This chapter introduces the Boost C + + library Asio, which is the core of asynchronous input and output. The name itself says everything: Asio means asynchronous input / output. The library allows C + + to process data asynchronously and is platform independent. Asynchronous data processing means that there is no need to wait for t ...
Posted by aliasneo86 on Mon, 11 Apr 2022 21:43:53 +0300