One article tells you how much CPU branch prediction affects performance

originate stackoverflow Last question Why it is faster to deal with an ordered array than to deal with an array without it , there are some discussions in the original text. Let's first reproduce the results and then explain why! We have the following two sections of code. The code looks similar, but in fact, the logic is the same. They count t ...

Posted by ray-solomon on Thu, 25 Jun 2020 14:28:53 +0200

LeetCode, Simple (Issue 13)

Catalog Topic 1: Minimum distance of characters Question 2: Baseball Match Question 3: Determining whether each other is character rearrangement Topic 4: Perimeter of an island Topic 5: The intersection of two arrays Title 6: Calculating prime numbers Question 7: Rotating Array Question 8: The average number of layers of a binary tree ...

Posted by PastorHank on Wed, 24 Jun 2020 03:57:16 +0200

c++ Smart Pointer Learning and Use

Original:https://www.fluentcpp.com/2018/12/25/free-ebook-smart-pointers/ One thing that quickly confuses your c++ code and hinders its readability is memory management.If you don't do it well, this can turn a simple logic into an inexpressive chaotic management and leave your code out of control of memo ...

Posted by lightningstrike on Mon, 22 Jun 2020 02:58:39 +0200

C++08 (Classes and Objects)

Classes and Objects Differences between 0.C/C++. 0.1.C Language Structures 0.2 Linking variables to functions 1. Classes and Objects 1.1 oop Thought (Thought of Object-Oriented Language) 1.2 Write a human Three Features of 2.C++. 2.1 Packaging (should be visible to you, should not be invisible t ...

Posted by sunnypal on Sat, 20 Jun 2020 03:39:27 +0200

C language examination on computer operation question bank (basic) (Reference)

Here are the possible code problems (Fundamentals) in the C language test: (if you like it, please share it with your friends! Thank you 1. Find the total number of numbers between 300-800 that can be divided by 3 or 5. # include <stdio.h> int main() { int i, s = 0; for (i=300;i<=800;i++) { ...

Posted by davidguz on Thu, 18 Jun 2020 08:23:53 +0200

The realization of Joseph's link list in C language

The realization of Joseph's link list in C language Joseph Ring is generally used for games in life Code block linklist.cpp: // linklist.cpp : defines the entry point for the console application. // #include "stdafx.h" #include "linklist.h" using namespace std; int _tmain(int argc, _TCHAR* argv[]) { l ...

Posted by thebadbad on Sun, 31 May 2020 12:43:52 +0200

UITableView to modify the font size of its own retrieval column

� UITableView can't be modified by using its own retrieval column. How to modify it? Get UITableViewIndex before HeaderView will display -(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section { for (UIView *view in [tableView subviews]) { if ([view isKindOfClass:[NSClassFromStr ...

Posted by Roddy87 on Sat, 23 May 2020 17:14:14 +0200

leetcode-3. Longest substring without repeating characters

leetcode-3. The longest substring without repeating characters. Given a string, please find out the length of the longest substring that does not contain duplicate characters. Example 1: Type: "abcabcbb" Output: 3 Explanation: because the longest substring without repeating characters is "abc", its length is 3. Example 2: ...

Posted by zildjohn01 on Thu, 14 May 2020 16:09:18 +0200

leetcode-4. Finding the median of two positive arrays

leetcode-4. Find the median of two positive arrays. Given two positive (small to large) arrays of sizes m and n, nums1 and nums2. Please find the median of these two positive sequence arrays, and the time complexity of the algorithm is required to be O(log(m + n)). You can assume that nums1 and nums2 are not both empty. Example 1: nums1 = [1, 3 ...

Posted by kooper on Thu, 14 May 2020 16:09:57 +0200

LeetCode -- longest substring without duplicate characters

LeetCode -- longest substring without duplicate characters Blog Description The information in this article comes from the Internet and personal summary, which is intended to summarize personal learning and experience. If there is any infringement, please contact me to delete it. Thank you! Explain leetcode Question, Interview 48 The longest ...

Posted by calevans on Sun, 03 May 2020 05:39:23 +0200