Discrete Mathematics Review Notes (Completed)

foreword

This article is a personal review note for the subject of "Discrete Mathematics", with emphasis on knowledge points.
The textbook is "Discrete Mathematics" published by Zuo Xiaoling, Shanghai Science and Technology Literature Publishing House.
There are too many definitions and theorems in textbooks, and the article only records important and commonly used definitions and theorems in textbooks and classrooms, and will not give in-depth explanations, and there will be some omissions.
Because some symbols cannot be typed out, there will be more pictures inserted in the middle.
finished. Please point out any mistakes.
The following is the text

Discrete mathematics is mainly divided into four parts:

  1. mathematical logic
  2. set theory
  3. algebraic system
  4. Graph Theory

mathematical logic

classical logic

Aristotle 's syllogism:

major premise --> minor premise --> conclusion

Leibniz summarized reasoning as symbolic calculation and proposed the idea of ​​thinking operation.
Boolean invented Boolean algebra, (it can also be interpreted as set algebra)
Morgan made an important contribution almost simultaneously and independently
Frege first proposed the axiomatic predicate logic system "conceptual text", which is a major progress in logic since Aristotle. Basically realize Leibniz's dream.

Contents of Mathematical Logic:

Propositional logic
Predicate logic
Axiomatic set theory
Recursion theory
Proof theory

propositional logic

basic concept

definition:

A proposition is a declarative sentence that can be judged true or false

Propositions cannot be interrogative sentences, command sentences, exclamatory sentences, etc.

A few notes on the truth value:

Temporal
Regional
Standard

definition:

For any given proposition, if it cannot be decomposed into simpler propositions, it is called an atomic proposition, otherwise, it becomes a compound proposition.

propositional connectives

negation, conjunction, disjunction, implication (condition), equivalence

insert image description here

insert image description here
Things to note are:

  1. Condition (implication): If and only if P is true and Q is false, P→Q is false; otherwise, P→Q are both true.
    Condition → determines which is the antecedent and which is the consequent.
  2. Double condition (equivalent): P↔Q is true if and only if P and Q are the same, otherwise it is false.
  3. priority:

negation > conjunction > disjunction > condition > double condition

  1. Incompatibility (incommensurability and disjunction): ▽
    (similar to XOR)
    insert image description here

insert image description hereExample:
insert image description here
formula classification

A formula whose value is always "true" is called a forever true formula , also known as a tautology .

The formula whose assignment is always a "false" value is called a permanent false formula , also known as a contradiction formula .

An expression that has both true and false values ​​is called a satisfiable expression

insert image description here

propositional equivalence

definition

If two formulas A and B have the same truth value no matter what assignments are made, then A and B are said to be logically equivalent, and A is also said to be equivalent to B, and we write A⇔B.

theorem

The necessary and sufficient condition of the propositional formula A⇔B is that A↔B is an eternal truth.

Commonly used equivalents:

insert image description here
In addition to using the truth table method to prove the equivalence of two propositional formulas, it can also be proved by the method of equivalent substitution (equivalent substitution).

Using the equivalent calculus of formulas, the following three basic purposes can be achieved.
Determine the basic types of propositional formulas, that is, determine or prove that a propositional formula is always true or false.
Prove that there is an equivalence relationship between two propositional formulas.
For complex propositional formulas Simplify.

propositional implication

definition

Propositional formula A is called eternally true implication propositional formula B, if and only if A → B is an eternally true formula, denoted as: A=>B Note the difference between A=>B
and A→B

insert image description here
Additional conjunctions:
insert image description here
insert image description here
insert image description here

Duality and Paradigm

Duality
insert image description hereinsert image description here

The simple conjunction of normal form is also called minor term, the minor term in the truth table is "true", and the disjunctive form of all minor terms (that is, the main disjunctive normal form) is the eternal truth form . The simple disjunction is also called the major term, the major term in the truth table is "false", and the conjunction of all major terms (that is, the main conjunction paradigm) is always false.
insert image description here
insert image description here

For any propositional formula, there are disjunctive normal form and conjunctive normal form which are equivalent to it.
The minor term in the truth table is true and the major term is false.

Example: Discrete Mathematics Program Experiment (C Language)——Program finds the main disjunctive normal form and the main disjunctive normal form.
Input a logical expression, and calculate the main disjunctive normal form and main disjunctive normal form of the expression according to the truth table method.

Algorithm idea:
Change the propositional formula into a suffix expression, save the result of the suffix processing in the structure, define the priority of each logical operation symbol, perform assignment calculation according to the method of the suffix expression, and store the result output as truth table. Select and output the main conjunctive normal form and main disjunctive normal form according to the truth table.
(The experimental code is attached here for reference only)

#include<stdio.h>
#include<string.h>
#define T 1
#define F 0
struct Stack{
    
    
    int top;
    char zf[80];
}number={
    
    -1},symbol={
    
    -1};
//number储存后缀表达式结果
//symbol 操作符栈,用来保存操作符 
int book[26];//记录变元元素和个数 
int num=0;//记录变元的个数 
int alphabet_true_false[26];
int enum_result[80];
char str_copy[80];
void numbers(char str[]);
void strings(char str[]);
void reverse_polish(char s[]);
int check(int num);
void function(int num);

int main()
{
    
    
    int i=0;
    char str[80];
    printf("**************************************\n");
    printf("使用小写字母表示变元,\n使用‘&’表示合取,\n使用‘|’表示析取,\n使用‘>’表示条件,\n使用‘<’表示双条件\n");
    printf("**************************************\n");
    strings(str);
	reverse_polish(str);
    function(num);
    return 0;
}

void numbers(char str[]){
    
    
	int i,len=strlen(str);
	for(i=0;i<len;i++){
    
    
        if(str[i]>='a'&&str[i]<='z'){
    
    
            if(book[str[i]-'a']==0){
    
     
				book[str[i]-'a']=1;    
				++num; 
			} 
    	}      
    }
}
 
void strings(char str[]){
    
    
	int i;
    gets(str);
    strcpy(str_copy,str);
    
    numbers(str);//记录变元的个数,用全局变量num储存 
    int len=strlen(str);
    for(i=0;i<len;i++){
    
    
        switch(str[i]){
    
    
            case '!':str[i]=')'+5;break;
            case '&':str[i]=')'+4;break;
            case '|':str[i]=')'+3;break;
            case '>':str[i]=')'+2;break;
            case '<':str[i]=')'+1;break;    
        }
    }
}

void reverse_polish(char s[]){
    
    
    int i,len=strlen(s);
    for(i=0;i<len;i++){
    
    
        if(s[i]>='a'&&s[i]<='z'){
    
    //如果是命题变元就直接入number栈 
            number.zf[++number.top]=s[i];          
        }else if(s[i]>')'&&s[i]<=5+')'){
    
            //符号为逻辑运算符
            if(symbol.top==-1||symbol.zf[symbol.top]==')'){
    
      
                ++symbol.top;
                symbol.zf[symbol.top]=s[i];
            }else if(s[i]>=symbol.zf[symbol.top]){
    
    
                ++symbol.top;
                symbol.zf[symbol.top]=s[i];
            }else{
    
    
                while(symbol.top!=-1&&s[i]<symbol.zf[symbol.top]){
    
    
                    ++number.top;
                    number.zf[number.top]=symbol.zf[symbol.top];
                    --symbol.top;
                }
                --i;
            }
        }
		else if(s[i]=='('||s[i]==')'){
    
      
		    if(s[i]=='('){
    
    
                ++symbol.top;
                symbol.zf[symbol.top]=s[i];
            }else{
    
    
                while(symbol.zf[symbol.top]!='('){
    
    
                    ++number.top;
                    number.zf[number.top]=symbol.zf[symbol.top];
                    --symbol.top;              
                }
                if(symbol.top!=-1)--symbol.top;
            }
        }       
    }
    while(symbol.top!=-1){
    
    
        ++number.top;
        number.zf[number.top]=symbol.zf[symbol.top];
        --symbol.top;                                
    }
}

int check(int num){
    
    
	struct Stack ans={
    
    -1};
	int i,k=0,len=0,temp;
	for(i=0;i<26;i++){
    
    
		if(book[i]){
    
    
			++len;
			alphabet_true_false[i]=enum_result[k++];

		}
	}
	for(i=0;i<=number.top;i++){
    
    
		if(number.zf[i]>='a'&&number.zf[i]<='z'){
    
    
			++ans.top;
			ans.zf[ans.top]=alphabet_true_false[number.zf[i]-'a'];
		}else{
    
    
			switch(number.zf[i]){
    
    
				case '.':
					ans.zf[ans.top]=!ans.zf[ans.top];
					break;
				case '-':
					ans.zf[ans.top-1]=ans.zf[ans.top-1]&ans.zf[ans.top];
					--ans.top;
					break;
				case ',':
					ans.zf[ans.top-1]=ans.zf[ans.top-1] | ans.zf[ans.top];
					--ans.top;
					break;
				case '+':
					ans.zf[ans.top-1]=!ans.zf[ans.top-1]|ans.zf[ans.top];
					--ans.top;
					break;
				case '*':ans.zf[ans.top-1]=
									 (!ans.zf[ans.top-1]|ans.zf[ans.top])
									&(!ans.zf[ans.top]|ans.zf[ans.top-1]);
					--ans.top;
			}
		}
	}
	printf("%4d\n",ans.zf[0]); 
	return ans.zf[0];
}

void function(int num){
    
    
	int i,j;
	int conjunction_top=-1,disjunction_top=-1;
	int result_conjunction[80]={
    
    0};
	int result_disjunction[80]={
    
    0};
	
	
	for(i=0;i<26;i++)
        if(book[i])printf("%4c|",i+'a');
	putchar(' '),puts(str_copy);
	for(i=0;i<(1<<num);i++){
    
    // 
		memset(enum_result,0,num);
		for(j=0;j<num;j++){
    
    
			if(i&(1<<(num-j-1))){
    
    
				enum_result[j]=T;
			}else{
    
    
				enum_result[j]=F;
			}
			printf("%4d|",enum_result[j]);
		}
		if(check(num)){
    
    
			result_disjunction[++disjunction_top]=i;
		}else{
    
    
			result_conjunction[++conjunction_top]=i;
		}
	}
	puts("\n主析取范式为:");
	for(i=0;i<=disjunction_top;i++){
    
    
		printf("m%d%s",result_disjunction[i],i^disjunction_top?"&":"");
	}
	puts("\n主合取范式为:");
	for(i=0;i<=conjunction_top;i++){
    
    
		printf("M%d%s",result_conjunction[i],i^conjunction_top?"|":"");
	}
}

reasoning theory

Methods to verify the validity of reasoning:

Truth Tables
Propositional Calculus

Three elements of propositional calculus:

Inference basis
Inference rules
Inference method

Inference rules:

P-Rule (Introduction of Premise Rules): Premises can be introduced at any step of the derivation.
T rule (introduction of conclusion rule): In the derivation process, if one or more propositional formulas are always true and imply the propositional formula S, then the formula S can also be introduced into the derivation process.
CP rule: if H1∧H2∧…∧Hn∧R => S, then H1∧H2∧…∧Hn => R→S

Reasoning basis:

Mainly refers to the known logical equivalence and logical implication

Reasoning method:

Direct proof method
Indirect proof method (contradictory method and additional precondition proof method)

Direct reasoning
is a method of deriving an effective conclusion directly from a set of premises, using P rules and T rules.
If the conclusion to be proved
is in the form of R → S, then the antecedent R of R → S in the conclusion can be used as an additional premise, and the subsequent S can be deduced together with the given premise.
Proof by contradiction:
To prove H1, H2, ..., Hn=>C, just prove that {H1, H2, ..., Hn , “C} is incompatible. Explanation
: To prove H1, H2, ..., Hn=>C , just prove that H1∧H2∧…∧H3=>F

predicate logic

basic concept

In the study of propositional logic, atomic propositions are the most basic units in propositional calculus, and atomic propositions are no longer decomposed, which will cause two major disadvantages: (1) It is impossible to study the internal structure,
composition and internal logic characteristics of propositions;
( 2) It is also impossible to express the common features of two atomic propositions, and even some simple and common reasoning processes cannot be handled in propositional logic.

therefore:

We can decompose atomic propositions into two parts: individual (noun, pronoun) + predicate (verb).

In the study of propositions, logic based on predicate analysis is called predicate logic. Predicate logic is the extension and development of propositional logic.

Concrete or abstract objects that can exist independently in the objective world are called individuals (objects), and words that represent individuals are called individual words. If an individual word represents a specific individual in a constant manner, it is called an individual constant; if an individual word generally refers to an uncertain individual in a variable manner, it is called an individual variable.

Words expressing individual (object) characteristics, properties, or relationships are called predicates.

A predicate together with individual constants can represent a proposition

An expression consisting of a predicate and some individual arguments is called a simple predicate function. If a function contains n individual arguments, it is called an n-ary simple predicate function.

A predicate function is not a proposition, it expresses a proposition only when all individual variables are substituted with certain individuals

An expression composed of a simple predicate function and a propositional connective is called a compound predicate function.

For a predicate function, each individual variable has its value range, which is called the individual domain (discourse domain) of the individual variable


The pronunciation of several expressions of the full quantifier
“∀”: ∀ x P(x): “for all x, x is…”;
∀ x ¬ P(x): “for all x, x is not…”;
¬ ∀ x P(x) : "Not for all x, x is...";
¬∀ x ¬ P(x): "Not for all x, x is not...".

There are
several expressions of the quantifier “∃”:
∃ x P(x): “There exists an x ​​such that x is…”;
∃ x ¬ P(x): “There exists an x ​​such that x is not…”;
¬ ∃ x P(x) : "There is not an x ​​such that x is...";
¬ ∃ x ¬ P(x) : "There is not an x ​​such that x is not...".
insert image description here
Example:
insert image description here
Constraint variable
Scope: The predicate formula in parentheses immediately after the quantifier.

For example ∀x P(x) , ∃ x (P(x) ∧ Q(x)) .
If the parentheses after the quantifier are atomic predicate formulas, the parentheses can be omitted.

Constraint variable : the variable within the scope of the quantifier and the same as the subscript of the quantifier.
Free variable : if and only if it is not bound by a quantifier.

For a formula, if the quantifiers are all at the beginning of the full formula, and their scope extends to the end of the whole formula, the formula is called the pre-beam normal form
insert image description here

Equivalence and Implication of Predicate Calculus

insert image description here
insert image description here
insert image description here
insert image description here
insert image description hereinsert image description here
insert image description here

insert image description here
insert image description here

Inference of Predicate Calculus

Basic elements of propositional reasoning Inference rules: P rule, T rule, CP rule
Reasoning method: truth table method, direct proof method, indirect proof method
Reasoning basis: equivalence formula, implication formula

In the predicate calculus, since the predicate formulas in the premise and conclusion often have quantifiers, it is necessary to eliminate and add quantifiers to use the equivalence and implication of propositional calculus.

Inference rules of predicate calculus :
universal designation (US), existence designation (ES), universal extension (UG), existence extension (EG).

insert image description here
insert image description here
insert image description here
insert image description here
example:
insert image description here
insert image description here

set theory

basic concept

Collection Definition: A collection is an unordered collection of distinct objects. Set elements in the set are called A contains a, denoted as a ∈ A.

The description of the collection includes: enumeration method: enumerate several elements inside one by one, and use the collection constructor and narrative method.

Sets are equal: Two sets are equal if and only if they have the same elements. That is to say: A and B are sets, then the condition that A and B are equal is if and only if (any X) (X∈A & X∈B), if A and B are equal, then A=B

insert image description here

special operations

insert image description here
insert image description here

insert image description here

Operation nature

insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here
insert image description here

The principle of inclusion and exclusion (the principle of inclusion and exclusion)

insert image description here
insert image description here
insert image description here

Ordinal Pair and Cartesian Product

Sequence pair: The name of an ordered binary group, which can be regarded as an ordered set, denoted as <A, B>

The sequence pair is different from the set in that the sequence pair is ordered, <A,B> != <B,A>, which is equivalent to a key-value pair.

Cartesian product: A and B are sets, then the Cartesian product of A and B is equivalent to A*B, which means <a, b>, where: a∈A, b∈B

insert image description here
Satisfy the distributive law:
insert image description here
insert image description here
insert image description here

relation

basic concepts of relationships

The relationship between sets A and B can be written as a subset of A * B belongs to a relationship, that is, a binary relationship from A to B is a subset of A * B.

We can remember this: For a binary relation R, any sequence pair <x, y> in R can be written as <x, y>∈R or <x, y> !∈ R

Either xRy or x!Ry

insert image description here
Front domain : In the binary relation <x,y> ER, the set consisting of all x is called the front domain.

Value range : In the binary relation <x,y> ER, the set composed of all y is called the value range.

Domain : The former domain and the value domain are initially equivalent to the union of the former domain and the value domain.

Relation matrix : We have two finite sets: X = {x1,x2,x3,...,xm}, Y={y1,y2,y3,...,yn}, R is a binary on X to Y relationship, then there is a corresponding relationship matrix: M = [rij]m*n

nature of relationship

Reflexive relation : R is a binary relation on the set X, if for every x ∈ X, there is xRx, then R is said to be reflexive.

Anti-reflexive relationship : We cannot have xRx on the basis of reflexivity.

Symmetrical relationship : For x, y ∈ X in the relationship, whenever xRy, there is yRx, and the relationship R above X is symmetric.

Antisymmetric relation : Roughly speaking, a binary relation R on a set X is antisymmetric if and only if there is no pair of distinct elements a, b in X that are R-relational to each other

Transitive relationship : For x, y, z ∈ X, whenever xRy, yRz has xRz, it is said that R is transitive on X.

nature of relationship

There should be no
reflexivity: should contain all <x, x>
symmetry: if there is <x, y>, there should be <y, x>
transitivity: if there are <x, y> and <y , z> should have
the sequence pair that <x, z> should have. If there is no pair, it will not be satisfied

Orders that should not exist cannot have
anti-reflexivity: there should not be any <x, x>
antisymmetry: if there are <x, y> there should be no
orders that should not have <y, x> not satisfied

Judging five properties from the relationship matrix and relationship diagram:
1. Reflexive:
the elements on the diagonal of the relationship matrix are all 1, and each node in the relationship diagram has a self-loop.
2. Symmetrical:
the relationship matrix is ​​a symmetric matrix. If there are directed arcs between two nodes in the relationship graph, they must appear in pairs.
3. Anti-reflexive:
the diagonal elements in the relationship matrix are all 0, and the relationship Each node in the graph has no self-loops.
4. Anti-symmetrical:
the diagonally symmetrical elements of the relationship matrix cannot be 1 at the same time, (but it can be a symmetric matrix, and they are 0 at the same time).
If there is a directed arc between two nodes in the relationship diagram, they cannot be paired Appear.
5. Transitivity:
It cannot be judged clearly, only the definition can be used.

The nature of the special relationship:

Null relations: anti-reflexivity, symmetry, antisymmetry, transitivity
Universal relations: reflexivity, symmetry , transitivity
Identity relations: reflexivity, symmetry, transitivity

Composite and inverse relationships

Composite Relationship :
Definition:

R is the relationship from X to Y, and S is the relationship from Y to Z. Then the composite relationship R°S of R and S is called the composite relationship of R and S, expressed as: RoS= {<x,z>|
x∈X And z∈Z(y∈Y ,<x, y>∈R and <y,z>∈S)}

The composite relationship is equivalent to passing elements one by one to see if the transitive relationship is satisfied.

Inverse relationship :
R is a binary relationship from X to Y. Reversing the order of the elements of each sequence pair in R, the relationship obtained is called the inverse relationship of R, denoted as R^c:

closure operation

insert image description hereinsert image description hereinsert image description here

From: https://blog.csdn.net/weixin_46503355/article/details/108060144

division of sets

Dividing a set A into several is called partitioning.
insert image description here

Equivalence Relations and Equivalence Classes

If a relation R on a set A satisfies reflexivity, symmetry, and transitivity, then R is called an equivalence relation on A.

Equivalence Class:
insert image description hereinsert image description hereCommerce Set:

R is an equivalence relation on A, and the set composed of all equivalence classes of R is called the quotient set of A with respect to R. Write it as A/R.
Equivalence
insert image description here
Relation and Division
insert image description here

compatible relationship

For a relation R on A, if R is reflexive and symmetric, then R is said to be a compatible relation.
insert image description here

order relationship

A relation R on a partial order relation
A, if R satisfies reflexivity, antisymmetry and transitivity, then R is a partial order relation on A. Write ≼let
≼ as a partial order relationship, if <x, y>∈≼, then write x≼y, read as x is less than or equal to y
ordinal <A,≼> called a partial order set
in a partial order set <A ,≼ >, let R be the partial order relationship on the non-empty set A, x, y∈A, if x ≺ y and there is no z ∈ \in ∈A such that x ≺ z ≺ y, then y is said to be covered ( Cover) x .
Chain and anti-chain
In a partially ordered set <A,≼>, in a subset of A, if every two elements are related, the subset is called a chain.

If every two elements in a subset are unrelated, the subset is called an antichain.

Total order relationship
In a partially ordered set <A,≼>, if A is a chain, then <A,≼> is called a total ordered set (or a line ordered set). In this case, the binary relation ≼ is called a total order relation or a line order relation.

Hastu

A Simplified Drawing Method of Pairwise Relational Diagram

① Since the order relationship is reflexive, each node has a cycle, which is omitted;

② Since the order relationship is antisymmetric and transitive, any two different nodes in the relationship graph will not have two-way edges or paths directly, so the arrow of the edge is omitted, and the upward direction is set as the direction of the arrow

③ Since the order relation is transmitted, all deduced edges are omitted.

Let <A,≼> be a poset, B⊆A, y∈B.

If ∀x(x∈B→y≼x) holds, then y is called the smallest element of B. (Unique)
If ∀x(x∈B→x≼y) holds, then y is called the largest element of B. ( Unique)
If ¬∃x (x∈B∧x ≺ y) holds true, then y is called a minimal element of B. (Local maximum)
If ¬∃x (x∈B∧y ≺ x) holds, then y is called The maximum element of B. (local maximum)

Let <A, ≼> be a poset, B⊆A, y∈A.

If ∀x(x∈B→x≼y) holds, then y is called the upper bound of B.
If ∀x(x∈B→y≼x) holds, then y is called the lower bound of B.
Let C={y | y is the upper bound of B}, then the smallest element of C is called the smallest upper bound or supremum of B.
Let D={y | y is the lower bound of B}, then the largest element of D is called the largest lower bound of B or infinity.

function

basic concept

Function
Let F be a binary relation, if any x∈domF has a unique y∈ranF so that xFy holds, then F is called a function

For the function F, if there is xFy, it is recorded as y=F(x), and y is called the value of F at x.

The front domain of f is the domain of definition of the function f(x), denoted as domf = X; the
value range ranf ⊆ Y
set Y of f is called the co-domain of f.

Surjection:
If ranf = Y, the mapping is called surjection (upper mapping)
Injection (injection):
Different x corresponds to different y
Bijection:
If the mapping f is both surjective and incident, the mapping is called bijective shoot.

Composite Functions, Characteristic Functions, and Cardinality

Suppose F, G are functions, then F○G is also a function, and satisfies

(1) dom(F○G)={x|x∈domF∧F(x)∈domG}
(2) Any x∈dom(F○G) has F○G(x)=F(G(x) )

Inverse function

Suppose f:A→B, and f is a bijection, then
f-1 :B→A, and f-1 is also a bijection.
If f: A→B is a bijection, then f-1: B→A is called The composition of two functions that is the inverse of f is a function

Characteristic Function

Characteristic function:
χA:E→{0,1}, χA(x)=1⟺x∈A
When Φ⊂A⊂E, χA is surjective

Cardinality

Suppose A and B are sets, if there is a bijective function from A to B (A to B is injective and surjective), then A and B are said to be equipotential, recorded as A≈B. If A does not If B is equipotential,
it is written as A≉B.

can also be defined as:

Given two sets, one-to-one correspondence between the elements of the two sets, then A and B are equipotential, denoted as A~B (bijection)

N ≈ Z ≈ Q ≈ N×N

Any interval of real numbers is equipotential to the set R of real numbers

The set composed of all sets equal to the set A is called the cardinality of the set A, denoted as K[A].

Any set equal to the set of natural numbers is called countable.

We call finite and countable sets at most countable sets.

Any infinite subset of a countable set is countable

Any infinite set must contain countable subsets.
Any infinite set must be equal to a certain proper subset.

If there is an incident from set A to set B, then the cardinality of A is not greater than the cardinality of B, that is, A≤B.

algebraic system

algebraic structure

basic concept

A set plus several operations represents an algebraic system, denoted <A, f1, f2,·····>.
For a set A, a mapping from A n to B becomes an n-ary operation on A.

Algebraic systems can be analyzed using tables of operations.
insert image description here

nature:

Closure:

x∈A, b∈A, a*b∈A;
when the property is satisfied, in the operation table:
every element in the operation table belongs to A.

Commutative law:
x * y = y * x;
when the property is satisfied, in the operation table:
the operation table is symmetrical about the main diagonal.
Distributive law:
x * (y ^ z) = (x ^ y ) * (x ^ z);
cannot be seen from the operation table.
Absorption law:
x * (y ^ z) = x
x ^ (y * z) = x
cannot be seen from the operation table.
Idempotency:
x * x = x ;
when the property is satisfied, in the operation table:
each element on the main diagonal is the same as the header element of the row (column) where it is located.
Zero element:
x * ⊙ = ⊙; (right zero element)
⊙ * x = ⊙; (left zero element)
when the property is satisfied, in the operation table:
the elements in the row and column corresponding to the zero element are the same as the element .

Unitary (unit unit):
x * e = x; (right unitary)
e * x = x; (left unitary)
when the property is satisfied, in the operation table:
the row or column corresponding to the unitary unit is the same as in the operation table The rows and columns are the same.

Inverse:
x * y = e; (y is the right inverse of x)
y * x = e; (y is the left inverse of x)

Other theorems :

There is no inverse element for zero element
When associative law is satisfied, the inverse element of a number is unique.
If a * a = a, then a is an idempotent element.

semigroup, group, subgroup

Broad Groups: Algebraic Systems Satisfied by
Closure

Semigroups: Associative Broad Groups
Closed, Associable

Singularity: there is a semigroup with unitary
closure, combinability, existence of unitary,

Group: A unique point where any element has an inverse.
Closed, associative, unitary, inverse between two elements

Theorem and Corollary

  1. The unique point is that there are no identical rows and columns in the calculation table.
  2. (a-1)-1 = a ;
  3. (a*b)-1 = b-1 * a-1 ;
  4. The number of elements in the finite group G is the order of the finite group.
    The set of integers <I,+> is a group.
  5. Let <S,*> be a semigroup, singular point or group, if S is a finite group, then there must be a∈S such that a * a = a. (there is an idempotent element)
  6. In the group <G, >, for any a, b, c belongs to G, if a b = a c or b a = c*a, then b = c. (elimination law)
  7. Let S be a non-empty set, and a bijection from set S to S is called a permutation of S. Each row or column in the operation table <G,*> of a group is a permutation of elements of G.
  8. In the group <G,*>, there can be no other idempotent elements except the unitary element e.
  9. For the group <G,*>, suppose there exists a subset <S, >, then the unitary in <G, > must be the unitary of <S, *>.
  10. For the group <G, *>, suppose there exists a subset <S, *>, if S={e}, or S = G, then <S, *> is said to be a trivial subset of <G, *>.
  11. For the group <G, >, B is a non-empty subset of G, if B is a finite set, then, as long as the operation * is closed on B, then <B, > must be a subgroup of <G, *>.

Abelian group, cyclic group

A commutative group , also known as an Abelian group , refers to a group whose operations satisfy the commutative law.

Cyclic group:
Let <G, *> be a group, if there is an element a in G, and any element in G is composed of the power of a, then the group is called a cyclic group, and the element a becomes the generation of a cyclic group Yuan.

Generators may not be unique.
Any cyclic group must be a commutative group.

If the order of G is n, that is, |G| = n, then a n = e ;
where e is a unitary element, n is the smallest positive integer that makes a n = e, and n is called the order of element a.

permutation group

temporarily omitted.

Cosets and Lagrange Theorem

Suppose <G, *> is a group, <H, *> is a subgroup, and a is an element in G:
aH={a * h|h∈H} The left coset of H about a
Ha={h * a |h∈H} The right coset a of H with respect to
a is called the representative element of the coset

to divide

Each element is non-null. There is no empty block
The union of all elements is G
Any intersection of two elements is empty

Equivalence relation
Relation R satisfies reflexive, symmetric, transitive

If <x,y>∈ R, say that x is equivalent to y, denoted as x~y

Equivalence class
A set of elements with equivalence relationship, denoted as [a] R

a is called the representative element of [a] R

Mall A/R

The set with all equivalence classes of R as elements is called the quotient set of A with respect to R

subgroup index

The cardinality of the set of cosets of G to H, that is, the number of cosets, is recorded as [G:H]

If A and B represent collections:

Product of A and B:
AB = {a * b | a∈A , b∈B }

Inverse of A and B:
A -1 = {a -1 | a∈A }

Lagrange's theorem:
H is a subgroup of G, then:

R={<a,b>|a∈G, b∈G and a -1 *b∈H}
R is an equivalence relation on G.
For a∈G, if record [a] R ={x|x∈G and <a,x>∈R}, then [a] R =aH
If G is a finite group, |G|=n, |H| =m, then m|n. ( | : Indicates divisibility)

inference:

A subgroup of a group of prime order must be a trivial group. (There is no non-trivial subgroup in a group of prime order.)
Suppose <G,*> is a group of order n, then for any a∈G, there is a n = e
finite group in which the order of elements can divide the
order of the prime order group of the group It must be a cyclic group, and each non-unit element is a generator.
Let <G, *> be a finite group of order n, then for any a∈G, the order of a must be a factor of n and there must be a n = e , where e is the unitary of <G, *>, if n is a prime number, then <G, *> must be a cyclic group.

Homomorphism and Isomorphism

Let <A, *> and <B, ^ > be two algebraic systems.

f is a mapping from A to B.

For any x, y∈A, there is:
f(x * y ) = f(x) ∧ f(y),
then f is called a homomorphic mapping from <A, *> to <B, ^ > .
Denote as A ~ B
<f(A), *> is a homomorphism of <A,⋆>

If f is also a bijection, then f is called an isomorphic map .
isomorphism relation is equivalence relation

Recorded as A ≌ B
property:
if <G, *> is a semigroup, then <f(G), *> is also a semigroup.
If <G, *> is a unique point, then <f(G), *> is also a unique point.
If <G, *> is a group, then <f(G), *> is also a group.

Homomorphic kernel:
Let f be the homomorphic mapping from group <G, *> to group <G', *>, e' is the unitary element of G', record
Ker(f) = {x | x∈ G and f( x) = e' }
Ker(f) is called the kernel of the homomorphic map f, referred to as the homomorphic kernel.

rings and domains

Let <A, + , *> be an algebraic system, if it satisfies:

  1. <A,+> is an Abelian group (commutative group)
  2. <A, *> is a semigroup
  3. The operation * satisfies the distributive law for the operation +. Then <A, + ,* > is called a ring .

In order to distinguish the two operations in the ring, the + operation is usually called the addition in the ring, and the · operation is the multiplication in the ring.
Zero element
Additive identity element, denoted as 0(θ)
identity element
Multiplicative identity element, denoted as 1
negative element
Additive inverse element, denoted as -x
inverse element
Multiplicative inverse element, denoted as x- 1

Example
<R,+,·> Ring of real numbers
<Q,+,·> Ring of rational numbers
<I,+,·> Ring of integers
<M n (I),+, ·> Ring of integer matrices of order n
<N k , +k , × k > modulo k integer ring
<Z[i], +, ·>(Z[i]=a+bi,a,b∈Z,i 2 =-1) Gaussian integer ring (complex number)
<R[x ] ,+, ·> R[x] is a real polynomial

Let <A, + , *> be an algebraic system, if it satisfies:

  1. <A,+> is an Abelian group (commutative group)
  2. <A, *> is a commutative unique point with no zero factor.
  3. The operation * satisfies the distributive law for the operation +.
    Then <A, + ,* > is called a complete ring .

The zero-factor condition in the ring is equivalent to the multiplicative elimination law.

Let <A, + , *> be an algebraic system, if it satisfies:

  1. <A,+> is an Abelian group (commutative group)
  2. <A-{⊙}, *> is an Abelian group
  3. The operation * satisfies the distributive law for the operation +.
    Then <A, + ,* > is called a field .

Properties:
1. The domain must be a whole ring.
2. A finite ring must be a field.
3. The homomorphic image of any ring is a ring

Let V1=<A, ,∘> and V2=<B,⊛,◎> be two rings, among which , ∘, ⊛ and ◎ are all binary operations.
f is a mapping from A to B such that

For ∀a, b∈A:
​ f(a*b)=f(a)⊛f(b)
​f (a∘b)=f(a)◎f(b)

Then f is said to be a homomorphic mapping from ring V1 to ring V2

Classification
If f is injective, surjective and bijective, f is said to be monomorphism, full homomorphism and isomorphism respectively The homomorphic
image and its properties
<f(A),⊛,◎> are <A,*,∘ > is a homomorphic image.

A homomorphism of any ring is like the ring

Lattice and Boolean Algebra

The basic concept of lattice

Let <A, ≤ > be a partially ordered set. If any two elements in A have the smallest upper bound and the largest lower bound, then <A, ≤ > is called a lattice.

In the lattice <A, ≤ >, two operations ∨ and ∧ are defined, a∨b means to find the minimum upper bound of a and b, and a∧b means to find the largest lower bound of a and b, which are respectively called the union operation and cross operation.

A totally ordered set is a lattice, but not all partially ordered sets are lattices.

nature:

Suppose <A, ≤ > is a lattice, and the algebraic system induced by <A, ≤ > is <A,∨,∧>, then <A,∨,∧> has the following properties:

Commutative law :
a∨b=b∨a, a∧b=b∧a.
Associative law :
a ∨ (b ∨ c) = (a ∨ b) ∨ c,
a ∧ (b ∧ c) = (a ∧ b) ∧ c.
Absorption law :
a ∨ (a ∧ b) = a,
a ∧ (a ∨ b) = a.
Power Law:
a∨a = a
a∧a = a

Theorem:
Let <A, ∨, ∧> be an algebraic system, in which ∨ and ∧ are binary operations and satisfy commutative, associative, and absorptive properties, then there is a partial order relation ≤ on A, so that <A, ≤> is a grid.
(Satisfying the law of absorption leads to the fact that they must satisfy the law of idempotence.)

∨ and ∧ do not necessarily satisfy the distributive law, but there must be a distributive inequality:
a∨(b∧c)≤(a∨b)∧(a∨c)
(a∧b)∨(a∧c)≤a∧(b ∨c)

Duality principle of lattice:
you can refer to the previous definition of duality rule, and replace ≤ with ≥ after duality.
insert image description here

special case

Suppose <A, ≤ > is a lattice, and the algebraic system induced by <A, ≤ > is <A,∨,∧>

Distributive lattice
If the algebraic system satisfies the distributive law, it is a distributive lattice, and
the chain must be a distributive lattice
with bounded lattices
with full upper bounds and full lower bounds.

Complements
Every element has a complement

Complement:
In a bounded lattice <A, ≤ >, for an element a, if there is b∈A, so that a∨b = 1, a∧b = 0, (1 is the supremum of the lattice, 0 is the lattice Infimum)
then b is the complement of a.
An element can have multiple complements or no complement.

Bulger
with supplementary qualifications

Boolean algebra

A complementary lattice is called Boolean , and the algebraic system <A,∨,∧> induced by Boolean is called Boolean algebra .

A Boolean algebra with a finite number of elements is called a finite Boolean algebra

Suppose <A, ≤ > is a finite lattice with all lower bounds 0, then for any non-zero element b, there exists at least one atom a such that a is less than or equal to b.

If a 1 , a 2 ·················································································· ( a n _ _ _ _ )

Graph Theory

Basic Concepts and Properties

Definition:
A graph is a triplet <V(G), E(G), ∮>
where V(G) is a non-empty node set,
E(G) is an edge set
∮ is E to node sequence even function

The degree of a node, expressed in dut(V)

A graph composed of only isolated nodes is called a zero point, and a graph composed of only one isolated node is called a trivial graph.

theorem:

  1. In each graph, the sum of node degrees is equal to twice the number of edges
    v∈V deg(V) = 2 | E |
  2. In any graph, there must be an even number of nodes with odd degree,
  3. A graph with parallel edges is called a multigraph
  4. A graph without parallel edges and self-loops is called a simple graph .

The undirected complete graph of n nodes is denoted as K n The number of edges of the undirected complete graph K n
of n nodes is n/2 * (n-1)

In a directed graph, a path from vertex v0 to vertex vn is a sequence of edges in the graph, where the end point of each edge is the start point of the next edge.

paths and loops

In a path, if the same edge does not appear twice, the path is said to be a simple path .
— In a path, if the same vertex does not appear twice, the path is called a basic path (or a chain ).
If the starting point v o and the end point v n of the path coincide, that is, v o =v n , then this path is called a loop .
A circuit without the same edge is called a simple circuit, and a circuit that passes through each vertex no more than once is called a basic circuit .
The number of edges contained in the path P is called the length of the path P.

In an undirected graph G, if there is a path between a node u and a node v, then u and v are said to be connected.

The connectivity between nodes is an equivalence relationship on the node set, so corresponding to this equivalence relationship, we can make a division of this graph G, and divide V into non-empty subsets V 1 , V 2 , V 3 , ······V m , so that two nodes v k and v j are connected if and only if they belong to the same V i . We call the subgraphs G(V 1 ), G(V 2 ),...G(V m ) the connected branches of G, and record the number of connected branches of G as W(G)

If a graph G has only one connected component, then G is a connected graph

(If any pair of vertices in the graph is connected, the graph is said to be connected, otherwise G is said to be disconnected.)

Subgraph
If V(H)⊆V(G) and E(H)⊆E(G), then H is said to be a subgraph of G, denoted as H⊆G.
Generate subgraph
If H is a subgraph of G and V(H)=V(G), then H is said to be a generated subgraph of G

Maximum degree and minimum degree
Δ(G) is the maximum degree of G
δ(G) is the minimum degree of G

Cut point
Let the undirected graph G=<V,E> be a connected graph, if the point set V 1 is a subset of V, after deleting all the nodes of V 1 in G , the resulting graph is not a connected graph, and the second deletion Except for any proper subset of V 1 , the obtained graph is still a connected graph, then V 1 is called a point cut set,
and if a point constitutes a point cut set, this point is called a cut point.

connectivity

k(G) = min{| V 1 | | V 1 is the point cut set of G}
as the point connectivity (connectivity) of graph G.

Connectivity is numerically equal to the number of elements in the point cut set, and
represents the minimum number of points that need to be deleted in order to generate a disconnected graph.

In a complete graph K p ,
k(K p ) = p-1
and deleting p-1 nodes will produce a trivial graph.

Similar to the definition of point cut sets, we define edge cut sets and cut edges (also called bridges )

Let the undirected graph G=<V,E> be a connected graph, if the edge set E 1 is a subset of E, so that after deleting all the edges of E 1 in G , the resulting graph is not a connected graph, and the second deletion except E 1 After any proper subset of , the resulting graph is still a connected graph, then V 1 is called an edge-cut set,
and if an edge constitutes an edge-cut set, this edge is called a cut edge (or bridge).

Also similar to point connectivity, we define edge connectivity :

λ(G) = min{| E 1 | | E 1 is the edge cut set of G}

The edge connectivity is numerically equal to the number of elements in the edge cut set,
indicating the minimum number of edges that need to be deleted in order to generate a disconnected graph.
λ(G) = 0 can be defined for trivial graphs, and λ(G) = 0 for a disconnected graph.

For any graph, there are:

k(G) < λ(G) < δ(G)

In a connected undirected graph G, the necessary and sufficient condition for node v to be a cut point is:

There are two nodes u and w such that every path between u and w passes through v.

Weak connectivity and strong connectivity:
A directed graph D=(V,E), replace all directed edges of the directed graph with undirected edges, and the resulting graph is called the base graph of the original graph. If
a The base graph of a directed graph is a connected graph, then the directed graph D is weakly connected, otherwise D is called disconnected. If any
two points u and v in D have access to v from u, or reachable from v u, then D is said to be one-way connected;
if every point u in D can reach any other point v, then D is said to be strongly connected.

A directed graph is strongly connected if and only if there is a cycle in G that contains each node at least once.

In a simple directed graph, the largest graph with strong connectivity is called a strong component graph.
The largest subgraph with one-sided connectivity is called one-sided subgraph.
The largest subgraph with weak connectivity is called a weak component graph.

The matrix of a graph represents
the adjacency matrix

When v i ,adj v j , a i*j = 1
When v i nadj v j or i==j, a i*j = 0
adj means connection, nadj means no connection

For undirected graphs, the adjacency matrix is ​​symmetric.
theorem:

Let A(G) be the adjacency matrix of graph G, then (A(G)) l in row i, column j element a l i*j is equal to the number of paths of length l connecting v i and v j in G

accessibility matrix

When v i has at least one path to v j , a i*j = 1
When v i does not have a path to v j or i==j, a i*j = 0

Full Incidence Matrix and Incidence Matrix

The incidence matrix M(G) is composed of the nodes of G and the edge set of G

When v i is associated with e j , a i*j = 1
When v i is not associated with e j , a i*j = 0

From the incidence matrix we can get:

  1. Each side of the graph is associated with two nodes, so each column of M(G) has only two 1s.
  2. The sum of the elements in each row is the degree of the corresponding node.
  3. The elements in a row are all 0, and the corresponding nodes are isolated nodes.
  4. The two columns corresponding to two parallel sides are the same.
  5. For the same graph, when the ordering of nodes or edges is different, the corresponding M(G) only differs in row order and column order.

Complete incidence matrix
The incidence matrix M(G) is composed of nodes of G and edge sets of G

When v i is the starting point of e j , a i*j = 1
When v i is the end point of e j , a i*j = -1
When v i is not associated with e j , a i*j = 0

If a connected graph G has r nodes, the rank of its complete correlation matrix M(G) is r-1, that is, rank M(G) = r-1.

special figure

Euler diagram

Visible The Seven Bridges of Königsberg

Given a graph G with no isolated nodes, if there is a path that passes through every edge of the graph once and only once, this path is called an Euler path .
If there is a circuit that passes through every edge in the graph once and only once, then the circuit is called an Euler circuit .
A graph with an Euler circuit is called an Euler path .

An undirected graph G has an Euler path if and only if G is connected and has zero or two nodes of odd degree.

For directed graphs:

  1. Given a directed graph G, a one-way path (loop) that passes through each edge of the graph once and only once is called a one-way Euler path (loop).

  2. A directed graph G has a one-way Euler circuit if and only if it is connected and the in-degree of each node is equal to the out-degree .
    A directed graph G has a one-way Euler path if and only if it is connected and the in-degree of each node is equal to the out-degree except for two nodes, but one of the two nodes The in-degree of a node is 1 greater than the out-degree, and the in-degree of another node is 1 less than the out-degree.

hamilton diagram

Given a graph G, if there exists a path that passes through every node in the graph exactly once, this path is called a Hamilton path .
If there is a cycle that passes through every node in the graph exactly once, this cycle is called a Hamiltonian cycle .

A graph with a Hamiltonian cycle is called a Hamiltonian graph .

If the graph G=<V, E> has a Hamiltonian cycle, then W(GS)≤|S| holds for every non-empty subset S of the node set v.
where W(GS) is the number of connected branches in GS.

The decision of the Hamiltonian diagram

Although the Hamiltonian circuit problem is very similar to the Euler circuit problem in form, there is no sufficient criterion for the existence of a Hamiltonian circuit in graph G. Below we give a sufficient condition for an undirected graph to have a Hamilton path.

  1. If the sum of the degrees of each pair of nodes in G is greater than or equal to n-1, then there is a Hamiltonian road in G.
  2. If the sum of the degrees of each pair of nodes in G is greater than or equal to n, then there is a Hamiltonian cycle in G.


Closure Given G={V,E}, there are n nodes, if the non-adjacent nodes in G whose degree sum is at least n are connected to get G', and this step is repeated, the closure of G is obtained package, denoted as C(G)

floor plan

Definition of planar graph
A graph is drawn on a plane, and if each edge of the graph is disjoint, the graph is called a planar graph.

Edge
Connected planar graph G, the area surrounded by the edges in the graph has neither nodes nor edges in the area, and such an area is called a face.

For a planar graph, the sum of the degrees of the faces is equal to twice the number of sides

Euler formula

Assuming a connected planar graph with v nodes, e edges and r faces, it satisfies:

v-e+r = 2

Properties and Theorems

  1. Let G be a connected simple planar graph: Then satisfy:
    e ≤ 3v - 6

  2. Given two graphs G1 and G2, if they are isomorphic, or if G1 and G2 are isomorphic after repeated insertion or removal of nodes with degree 2, then the two graphs are said to be isomorphic within the 2-degree nodes.

  3. Kuratuski's theorem:
    A graph is planar if and only if it contains no subgraphs isomorphic to K 3.3 or K 5
    (that is, if K3, 3 or K5 can be subdivided into this pair , then the graph is non-planar.)

Dual graphs and coloring

The pictures and descriptions here are taken from:
https://blog.csdn.net/qq_37868325/article/details/83867178

insert image description here

For each planar graph, there is a corresponding dual graph. We assume that the above example graph is graph G, and its corresponding dual graph G*, then for G, each point on G corresponds to the Each face of . For example, the following is G*.

insert image description here
The above points are the points in the dual graph G.
What about the edges in the dual graph G? For each original edge e in G, it is the intersection of two faces (for example, faces f1 and f2), then in In the dual graph, we connect the points (f1 * to f2*) mapped to the two faces (f1, f2) in G. If f1 == f2 (for example, the edge 5, 6 in G, Both sides of the edge are the same face, then we build a back edge.
The graph looks like this (the back edge is at 5 and 6).
insert image description here

Self-dual graph
If the dual graph G' of a graph G is isomorphic to G, then the graph G is said to be a self-dual graph.

Properties and theorems:

  1. For a complete graph K n of n nodes , x(K n ) = n;
  2. Let G be a connected planar graph with at least three nodes, then there must be a node u in G such that
    deg(u) ≤ 5
  3. Any planar graph G is at most 5-color
  4. If G is self-dual, then e = 2v-2 (textbook P321 after-school questions)

tree and spanning tree

Definition
A connected and undirected graph without loops is called a tree.
The nodes with degree 1 in the book are called leaves.
A node with a degree greater than 1 is called a branch node or an interior node.
An undirected graph with no loops is called a forest, and each connected branch of it is a tree.

Theorem and properties

  1. Given a graph T, the following definitions of trees are equivalent:
  1. Connected graph without loops
  2. There is no cycle and e = v-1, where e is the number of edges and v is the number of nodes.
  3. connected and e = v-1
  4. no cycle, but add a new edge, get one and only one cycle
  5. Connected, but not connected after any edge of the mountain
  6. There is one and only one path between each pair of nodes
  1. Any tree has at least two leaves
  2. If the spanning subgraph of graph G is a tree, then the tree is called the spanning tree of G.

Suppose G has a spanning tree T, then the edges of T are called branches. The
edges of graph G that are not in the spanning tree are called chords. The
set of all chords is called the complement of the spanning tree T.

  1. A connected graph has at least one spanning tree
  2. A cycle and the complement of any spanning tree have at least one common edge
  3. An edge-cut set and the complement of any spanning tree have at least one common edge.
  4. Among all spanning trees in graph G, the spanning tree with the smallest tree weight is called the minimum spanning tree .
    (The two algorithms for finding the minimum spanning tree can be seen in the algorithm in the data structure notes: data structure notes )

root tree

definition

  1. If a directed graph is a tree regardless of the direction of the edge, then this directed graph is called a directed tree .

  2. A directed tree is called a rooted tree if there is exactly one node with in-degree 0 and all other nodes with in-degree 1 .
    A node with an in-degree of 0 is called a root, a node with an out-degree of 0 is called a leaf, and a node with a non-zero out-degree is called a branch point or an inner point.

  3. The root tree contains one or more nodes, one of these nodes is called the root, and all other nodes are divided into a finite number of sub-root trees .

  4. In a rooted tree, if the out-degree of each node is less than or equal to m, the tree is called an m-ary tree .

  5. If the out-degree of each node is exactly equal to m or 0, the tree is called a complete m-ary tree , and if all its leaves have the same level, it becomes a regular m-ary tree. When m=2, it is called a binary tree.

  6. In a rooted tree, the path length of a node is the number of edges in the path from the root of the tree to the node. We refer to the path length of the branch point as the internal path length. The path length of a leaf is called the external path length.

Properties and Theorems

  1. Assuming a complete m-ary tree, the number of leaves is t, and the number of branch points is i, then:

(m-1) i = t-1

  1. If there are n branch points in the complete binary tree, and the sum of the lengths of the internal paths is I, and the sum of the lengths of the external paths is E, then:

E = I +2n

  1. In a weighted binary tree, if the leaf with weight w i has a path length of L(w i ), we call w(T) = ∑ i=1 t w i L(w i ) as the weighted The right of the binary tree.
    Among all weighted w 1 , w 2 ,······w i binary trees, the tree with the smallest w(T) is called the optimal tree
  2. Let T be the optimal tree with weight w 1 ≤ w 2 , ≤···≤w i , then
  1. The leaves v w1 and v w2 with weights w 1 and w 2 are brothers.
  2. The branch point with leaves v w1 and v w2 as sons has the longest path length.
  1. Let T be the optimal tree with weight w 1 ≤ w 2 , ≤···≤w i , if the branch point with the leaves of weight w 1 and w 2 as sons is changed to weight w 1 +w 2 leaves, get a new tree T', then T' is also the optimal tree.

Prefix code problem
(Huffman coding, visible data structure notes Huffman coding part of the data structure notes )

Guess you like

Origin blog.csdn.net/qq_51594676/article/details/122138122