The number i/ii/iii that appears only once in LeetCode
The number i that appears only once
Title Description
Topic analysis
When I first looked at the question of xxxx, I had no idea at all. The method is too inefficient. Later, I saw on the Internet that the solution uses XOR, but I haven't understood what the principle is. Recently, the school is learning "the principle of computer ...
Posted by taiger on Sun, 05 Sep 2021 11:16:27 -0700
[C + + programming problem] occupy seats
[problem description] the classroom seats in sun's school can be reserved every day. A person can occupy multiple seats and must have consecutive seats. If he can't occupy so many seats he requires, he won't want any more. In order to reduce the difficulty, seats are allocated from small to large according to the seat number each time, and seat ...
Posted by Mad_Mike on Sun, 05 Sep 2021 11:03:49 -0700
Introduction to C + + smart pointer
Write before:
In many scenarios, we need to apply for memory dynamically, but the use of dynamic memory is prone to problems, because it is extremely difficult to ensure that the memory is released at the right time. Sometimes we forget to release memory. This situation will lead to memory leakage, which is difficult to find, because the ph ...
Posted by naveenbj on Sun, 05 Sep 2021 10:59:01 -0700
C++ Data Structure and Algorithmic Analysis--Binary Search
Binary Search
introduce
Binary search, also known as half search, logarithmic search.Is an algorithm used to find a number in an ordered array.
Example
Title Description
Given an ordered ascending integer array of n elements, nums, and a target value, write a function to search for the target in nums, and return -1 if the target value has ...
Posted by cmason22 on Sun, 05 Sep 2021 09:18:10 -0700
Learning records for C + + beginners 14
Chapter 14 overloaded operators and type conversion
14.1 basic concepts
A unary operator has one argument
Binary operator: the left operand is passed to the first parameter, and the right operand is the second parameter
Except overloaded function call operator(), it cannot contain default arguments
If the operator function is a member func ...
Posted by eric_e on Fri, 03 Sep 2021 13:25:17 -0700
SLIC Superpixel Segmentation (C++)
Summary:
SLIC: simple linear iterative clustering, a simple linear iterative clustering, uses k-means clustering to generate super-pixels, which is simple to implement, efficient to run, and has a better boundary preservation effect. The specific results compared with other methods are detailed in the following paper.
Paper address:https: ...
Posted by babygodzilla on Fri, 03 Sep 2021 11:40:23 -0700
[C + +] smart pointer
1. Why do I need a smart pointer?
when using pointers, we generally need to apply for a piece of memory space from the memory for use, but if we forget to release the block space, it will cause memory leakage. and if the program has exception handling and throws an exception when applying for memory usage time, th ...
Posted by korporaal on Thu, 02 Sep 2021 15:55:42 -0700
stable_sort user defined comparison function stepping pit (shallow understanding)
1. General
"A good memory is better than a bad pen". This article is the first article of "difficult and miscellaneous diseases encountered". This article mainly introduces the STL stable encountered in today's work_ The problem of custom comparison function of sort algorithm is only a superficial introduction. The specific ...
Posted by Lokolo on Wed, 01 Sep 2021 22:26:07 -0700
Practical experience 79 beware of object cutting
The book Thinking in C + + discusses object slicing as follows: if a derived class object is forcibly transformed upward into a base class by passing values instead of pointers and references, the derived class object will be cut into a base class object after upward transformation, that is, the unique member variables and methods in the derive ...
Posted by gamesmstr on Wed, 01 Sep 2021 19:46:11 -0700
LeetCode - operation of numbers
Integer division
thinking
Cross border problem
Critical point negative 0x8000000, positive 07fffffConvert a and b to negative numbers, and the highest bit can be used.The problem becomes a loop, which is a < = BCritical point:
a==0 return 0;if ((a == 0x80000000 && b == -1) || (a == 0x7fffffff && b ...
Posted by ict on Wed, 01 Sep 2021 11:00:25 -0700