C + + template primary and STL
Template 1
1.1 generic programming
First, let's add two numbers
int Add(int x, int y)
{
return x + y;
}
double Add(double x, double y)
{
return x + y;
}
char Add(char x, char y)
{
return x + y;
}
Although function overloading can be implemented, there are several disadvantages:
Overloaded functions only have different types, and ...
Added by mapleleaf on Mon, 28 Feb 2022 13:19:28 +0200
JAVA array declaration, create, use, multidimensional array, Arrays class, bubble sort, sparse array
array
An ordered collection of data of the same type It describes several data of the same type, which are arranged and combined in a certain order Among them, each data is called an array element, and each array element can access them through a subscript
Array features:
The length is fixed. Once the array is created, its size cann ...
Added by sandrol76 on Mon, 28 Feb 2022 12:29:58 +0200
[true question 3 of blue bridge] the reform of blue bridge becomes difficult. If you want to enter the national competition, you can't lack any of these abilities
⭐ Introduction ⭐ ️
Hello, I'm Zhijie. There is only one month left for the countdown of the provincial competition of the Blue Bridge Cup. If you have practiced the real problem for nearly seven or eight years, you can obviously feel that the difficulty of the Blue Bridge Cup is becoming more and more difficult. Although it is far from being ...
Added by airdee on Mon, 28 Feb 2022 02:39:12 +0200
It took so long for Numpy to really use the ndarray object
ndarray object of Numpy Library
1, ndarray object of numpy
One of the most important features of numpy is its
The dimensional array object ndarray is a collection of a series of data of the same type. The index of the elements in the collection starts with the subscript 0
To create an ndarray, you only need to call Numpy's array functio ...
Added by mgmoses on Sun, 27 Feb 2022 17:27:04 +0200
Java annotation and reflection mechanism
Java annotation
Introduction to annotation
Annotation is from jdk5 0 began to introduce new technologies that can be used for checking and constraints Function of Annotation:
It's not the procedure itself. It can be explained (this is no different from a comment.)It can be read by other programs (such as compiler, etc.) Format of An ...
Added by falcon1 on Sun, 27 Feb 2022 16:29:49 +0200
Detailed explanation and application of merging and sorting
After reading this article, you can not only learn the algorithm routine, but also win the following topics on LeetCode:912. Sort array (medium)315. Calculate the number of elements on the right that are smaller than the current element (difficult)-----------Many readers have always said that they want me to use it Frame thinking To talk about ...
Added by dr_freak on Sun, 27 Feb 2022 16:05:22 +0200
day 8 course summary
day 8 course summary
String related functions: len, str, eval
Str (data) converts the specified data into a string (put quotation marks directly outside the printed value of the data) eval (string) evaluates the result of a string expression
str1 = '[10, 20, 30]'
result = eval(str1)
print(result)
result.append(100)
print(res ...
Added by blueman on Sun, 27 Feb 2022 15:36:32 +0200
Python thread, role of with (automatically acquire and release Lock)
Python thread, role of with (automatically acquire and release Lock)
import threading
import time
num=0 #Global variables can be read and written by multiple threads to transfer data
mutex=threading.Lock() #Create a lock
class Mythread(threading.Thread):
def run(self):
global num
with mutex: #The function of with Lock ...
Added by jeanne on Sun, 27 Feb 2022 13:24:12 +0200
Python basic syntax
1, Variables and data types
Python data types are not declared, and the compiler automatically recognizes them. The common data types are as follows; There is no need to add a semicolon at the end of each line of Python code; Python code blocks need to follow strict indentation rules; Python 3 habitually adds parentheses when ...
Added by Theramore on Sun, 27 Feb 2022 10:45:49 +0200
Source code analysis of Wait Notify NotifyAll of Object
The source code of Wait Notify NotifyAll in the Object class in Java is as follows:
/**
* Thread waiting
* @param var1 millisecond
* @param var3 nanosecond
*/
public final void wait(long var1, int var3) throws InterruptedException {
if (var1 < 0L) {
throw new IllegalArgumentException("timeout valu ...
Added by anon_login_001 on Sun, 27 Feb 2022 09:30:30 +0200