Wonderful sorting operation
In the second part, let's write some wonderful sorting operations.
1, Bucket sorting
When we sort a string of numbers, what method should we use? There are many kinds, bubble sort, bucket sort, quick sort, sort The first one is to introduce bucket sorting.
What is bucket sorting?
We now have six numbers 6 5 7 9 1 4. We're going to sort him? ...
Added by GaryE on Sat, 22 Jan 2022 04:26:13 +0200
Pointer exercises
catalogue
First question
Second question
Question 3
Question 4
Question 5
Question 6
Question 7
Question 8
First question
int main()
{
int a[5] = { 1, 2, 3, 4, 5 };
int *ptr = (int *)(&a + 1);
printf( "%d,%d", *(a + 1), *(ptr - 1));
return 0;
}
A is the address of the first element of the array, so * (a + 1) is the second ...
Added by alvinphp on Sat, 22 Jan 2022 03:55:43 +0200
[C + + template] - class template
1. Class template syntax
Class template function: Create a general class. The member data types in the class can be represented by a virtual type without specific formulation. Class template syntax:
template<typename T>
class
Template - declare the creation of a template typename - the symbol behind the surface is a data type, which c ...
Added by ajmoore on Sat, 22 Jan 2022 01:44:27 +0200
Ten classical sorting algorithms and their optimization
Ten classical sorting algorithms and their optimization
Algorithm overview
0.1 algorithm classification
Ten common sorting algorithms can be divided into two categories:
Nonlinear time comparison sort:
The relative order between elements is determined by comparison. Because its time complexity can not exceed O(nlogn), it is called nonline ...
Added by ashutosh.titan on Fri, 21 Jan 2022 23:20:02 +0200
C + + classes and objects -- encapsulation
https://www.bilibili.com/video/BV1et411b73Z?p=99https://www.bilibili.com/video/BV1et411b73Z?p=99
The three characteristics of C + + object-oriented are encapsulation, inheritance and polymorphism
C + + believes that everything is an object, and the object has its properties and behavior
For example:
People can be used as objects. The attr ...
Added by potato on Fri, 21 Jan 2022 21:45:11 +0200
Notes 6 of C + + programming (Tan Haoqiang)
Chapter 7 operator overloading
1, Operator overload definition
Function type operator operator operator name (formal parameter table) {process operator} For example, overload the +: Complex operator + (Complex & C1, Complex & C2) of Complex type c3 = c1+c2 is equivalent to c3 = operator+(c1,c2) Operators that cannot be overloa ...
Added by raydona on Fri, 21 Jan 2022 14:36:22 +0200
Pointer and string
Tip: after the article is written, the directory can be generated automatically. Please refer to the help document on the right for how to generate it
Tip: the following is the main content of this article. The following cases can be used for reference
1, What's the use of pointers
1. Pointer application scenario 1
Exchange the values ...
Added by SephirGaine on Fri, 21 Jan 2022 07:12:30 +0200
[copy problem solutions and replace learning with problems] the first algorithm class
c + + anonymous school has opened many courses according to c + + programming.
It was a sunny day. The breeze caresses the earth, across the river bank and plays among the willows. Xiaohang left the dormitory and walked to the "algorithm classroom" in the spring shower.
The algorithm class is taught by XC teacher. "Ding - Ding ...
Added by willc on Fri, 21 Jan 2022 06:16:21 +0200
CS101 2021Fall PA3,4 problem solution
CS101 2021Fall PA3,4 problem solution
PA3
The title description of PA3 is really the most unspeakable of the four Pa. at the beginning, both Title 1 and Title 2 are conditionally missing. In particular, the description of Title 2 is very unclear, there is no example explanation, and there is no accurate and rigorous definition of what scheme ...
Added by MichaelGallagher on Fri, 21 Jan 2022 06:10:06 +0200
Object oriented programming C + +: inheritance, derivation and polymorphism
Experiment content: using inheritance and derivation to realize function
(1) Three derived classes, classroom, office and laboratory, are derived from the "room" base class. The requirements are as follows: "Classroom" category includes: building number, room number, number of seats and person in charge (one executive); &qu ...
Added by chawezul on Fri, 21 Jan 2022 05:31:51 +0200