and rightchild.2. Delete the dual branch, need to find its successor, the data exchange between the two, converted to delete the subsequent relay.3. Delete both the root node and the leaf node, then adjust the corresponding root.It is important to summarize the idea that the deletion of all nodes is rooted in the deletion of the leaves.Static Bstnode*Buynode () {Bstnode*S=(Bstnode*) malloc (sizeof (Bstnode)); ASSERT (S!= NULL); memset (s),0, sizeof (Bstnode));returns;} StaticvoidFreenode (Bstno
To support the polymorphism of C + +, dynamic binding and static binding are used.1. Static type of object: the type that the object takes when declaring. is determined at compile time.2. The object's dynamic type: The declaration of the object currently referred to. Determined at run time. The dynamic type of the object can be changed, but the static type cannot be changed.For a static type and dynamic type of an object, see an example:classa{};classB: Publica{};classC: Publica{};intMain () {C(
. Msg_remove_queue (Resource $queue) Msg_remove_queue is used to destroy a queue. ? The sample code _1 just shows the application of the PHP operation Message Queuing function. The following code specifically describes the scenario for interprocess communication
The result of the operation is:
no.0 child process was created, the PID are 5249no.1 child process were created, the PID is 5250no.2 child process was creat Ed, the PID is 5251no.3 child process were created, the PID is 5252no.4 chil
the message queue metadata is complete, including the number of messages to be read in the message queue and the process ID of the last read/write queue. The sample code returns the number of messages to be read in the queue msg_qnum value in the array returned by calling the function in row 8th. Msg_receive (resource $ queue, int $ desiredmsgtype, int $ msgtype, int $ maxsize, mixed $ message [, bool $ unserialize [, int $ flags [, int $ errorcode]) msg_receive is used to read data in the m
following code describes the scenario of inter-process communication.
The running result is:
No.0 child process was created, the pid is 5249No.1 child process was created, the pid is 5250No.2 child process was created, the pid is 5251No.3 child process was created, the pid is 5252No.4 child process was created, the pid is 5253process.5251 is writing nowthis is process.5251's dataprocess.5253 is writing nowprocess.5252 is writing nowprocess.5250 is
, MSG_IPC_NOWAIT );Echo $ message;// Determine whether the queue is empty. Exit if it is empty.// Break;} While (true)?>
The running result is:Copy codeThe Code is as follows: No.0 child process was created, the pid is 5249No.1 child process was created, the pid is 5250No. 2 child process was created, the pid is 5251No. 3 child process was created, the pid is 5252No. 4 child process was created, the pid is 5253Process.5251 is writing nowThis is process.5251's dataProcess.5253 is writing nowProce
assigns a serial number to each packet segment to be sent. The serial number of each packet segment is the serial number of the First Data byte of the packet segment. That is, the serial number field value of the packet segment defines the number (byte number) assigned by the First Data byte contained in the packet segment ).C. Confirmation Number
TCP communication is full-duplex communication. After the connection is established, both parties can send and receive data simultaneously. Generally
. Msg_remove_queue (Resource $queue) Msg_remove_queue is used to destroy a queue. ? The sample code _1 just shows the application of the PHP operation Message Queuing function. The following code specifically describes the scenario for interprocess communication
The result of the operation is:
no.0 child process was created, the PID are 5249no.1 child process were created, the PID is 5250no.2 child process was creat Ed, the PID is 5251no.3 child process were created, the PID is 5252no.4 chil
Fmt. Println ([]rune (STR1))//number of characters
}
The output is:
Words of the wordWords of the word232Go language10941
(3) The string supports the normal comparison operator operation, which compares the operator in memory by a byte-by-byte comparison string. Of course, this comparison is done in the order of UTF-8 encoding.
(4) The last instance of the operation: Len ([]rune (STR1)), in the Go language, a string can be expressed in a rune (also known as Int32) array, each of whi
value of pointer type
/* Define a function that returns a pointer to the type int
/int *swap (int *px, int *py)
{
int temp;
temp = *px;
*px = *py;
*py = temp;
return px;
}
int main (void)
{
int i = ten;
int j =;
int *m = Swap (i, j);
printf ("i=%d, j=%d, *m=%d \ n", I, J, *m);
return 0;
}
The program output is:
I=20, j=10, *m=20
return px is equivalent to defining a temporary pointer of type int to save PX, and then assigning the pointer to
{Public:Virtual void get (){Cout }};Int main (){A * pa = new ();Pa-> get ();B * pb = (B *) pa;Pb-> get ();Delete pa, pb;Pa = new B ();Pa-> get ();Pb = (B *) pa;Pb-> get ();Return 0;}
Ou
. In fact, the second method is more reasonable, indicating that the variable A itself is modified, so the value of A is immutable.When the type is pointer, the circle is star *, and const is added to both sides of the left and right, which has different meanings.1) const int * pA = A; (you can write it as int const * pA = A; note that it is bounded by an asterisk)2) int * const
] * [0 SV 0][0 0 1]
The Su and SV values are the zooming rate in the X and Y axes respectively. If the value is greater than 1, The zooming rate increases. If the value is greater than 0, the zooming rate decreases when the value is smaller than 1, and if the value is less than 0, the zooming Rate.
Does the matrix look dizzy? In fact, the above formula is expanded by matrix multiplication:
{X = u * su
{Y = V * SV
That's simple. Pai_^
With the above three preparations, you can start to write code
1. Assume that there are two linear tables listed in ascending order of element values, all of which are stored as single-chain tables. Compile an algorithm to merge the two single-chain tables into a single-chain table in descending order of element values, and use the nodes of the original two single-chain tables to store the merged single-chain table.
Analysis: The difference between adding a node to the head of the linked list and adding a node to the end of the linked list
List Union (l
(7) pointer operation
In the previous articles, we have seen the usage scenarios of pointer operations and used multiple pointer operations for verification. Here we will particularly summarize the essential meaning of pointer operations.
In C language, if p, Pa, and Pb are all pointer types, such operations are called pointer operations:
, Premise: the PA and Pb types are the same.
Its essence is 1 .
node's DP value to take maximum. When the DP value is calculated along the path, the PA->SON,SON->PA boundary value dis is modified to now, and then the child node of son does not need to pa->son the farthest distance of this path .... Estimated to see this everyone is messy, look at the code bar ..... ..... ....... ........./************************************
1. The use of inheritance: Write a class, this class and the previous written class, just add some members or changes to the original member's behavior, you can inherit the original class, the grammar does not expand to say, through the code to write a few sentences summary.#include using namespacestd;classA { Public: Virtual voidFvoid) {cout "A ' f (void)!"Endl;} Virtual voidVF () {cout "A ' VF () running!"Endl;}};classD | PublicA { Public: voidFint) {cout "B ' f (int)!"Endl;} Virtual voi
Do not tangle character arrays and character pointers
Some Characteristics of character arrays and character pointers in C language are a bit fuzzy. Sometimes I only know why I want to do this, but I forget it after a while, next time, it will take time and effort to find the answer. OK. Let's take a look at it today ~
Here are two basic concepts:
1. Declare a character array
int a[10];Defines an array a with a length of 10. In other words, it defines a set of 10 objects, which are stored in adj
In practice, the intelligent pointer unique_ptr series in c ++ -- uses unique_ptr to avoid multi-layer if nestingToday, I saw this article and thought it was not very nice.
We like process control too much and write too much if else in the program.
Maybe we are very clear about the logic, but it is a disaster for people who read your code.
Many people say that polymorphism is used to avoid excessive if else nesting, but sometimes you may think that writing a new class seems a little tricky, espe
] * [0 Sv 0][0 0 1]
Where the SU,SV is the X-axis direction and the Y-axis of the zoom rate, greater than 1 o'clock magnification, greater than 0 is less than 1 o'clock reduced, less than 0 when reversed.
The matrix is not looking faint. In fact, the above-matrix multiplication is:
{x = u * Su
{y = v * Sv
It's so simple. ^_^
With the preparation of the three above, you can begin to write code implementations. The idea is simple: first use a double loop to traverse each point coordinate of the ta
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.