Data structure and algorithm - recognize graph structure, graph representation, graph structure implementation, graph traversal

catalogue 1, Initial graph structure 1. What is a graph 2. Features of the drawing   3. Terminology of Graphs         (1). vertex         (2). edge         (3). Adjacent vertex         (4). degree         (5). route     & ...

Posted by siefkencp on Wed, 12 Jan 2022 19:40:26 +0100

Linked list of the second day of data structure

Day 2 - linked list In fact, the linked list is relatively simple. For a data field and a pointer field, there are only a few common solutions, such as double pointers. But since I am a Java to C + +, the difficulty for me is to remember to release the space for application. So practice and record. Remove linked list elements Force buckle or ...

Posted by jonwondering on Wed, 12 Jan 2022 19:12:58 +0100

Red black tree principle and java implementation

Red black tree Red black tree rule features: Nodes are red or black;The root node must be black;All leaf nodes are black and null;The two child nodes connecting the red node are black (no adjacent red nodes appear in the red black tree);Starting from any node, the path to each leaf node contains the same number of black nodes;The nodes newl ...

Posted by martincrumlish on Wed, 12 Jan 2022 12:45:50 +0100

Minimum generation of graphs prim and knuskar

1, Code implementation of knuskar 1. Implementation of adjacency matrix of graph mgraph.go package graph import "errors" const MaxSize = 20 type MGraph struct { Edges [MaxSize][MaxSize]int EdgeNum int Nodes []string Indexs map[string]int } type Edge struct { NodeStart, NodeEnd string Val int } func NewMGraph() ...

Posted by cjl on Wed, 12 Jan 2022 10:41:29 +0100

Find the length of the longest palindrome string

Longest palindrome string String abcbada the longest palindrome string is abcba. The longest palindrome string ensures that the first and last characters are the same, and the substring after removing the first and last characters is also a palindrome string, such as bcb. According to this rule, ab is not a palindrome string because the beginni ...

Posted by quiphics on Wed, 12 Jan 2022 09:19:14 +0100

On the use and implementation of stack and queue in Java collection framework

1. Queue 1.1 concept Queue: a special linear table that only allows inserting data at one end and deleting data at the other end. The queue has the characteristics of first in first out FIFO(First In First Out). Queue entry: the end of the insertion operation is called Tail/Rear Out of queue: the end for deletion is called Head/Front Ill ...

Posted by Krash on Wed, 12 Jan 2022 09:10:41 +0100

Data structure and algorithm 12 quick sorting (fast sorting)

3.7 quick sort (quick sort) Quick sort is an improvement of bubble sort. Its basic idea is to divide the data to be sorted into two independent parts through one-time sorting. All the data in one part is smaller than all the data in the other part, and then quickly sort the two parts of data according to this method. The whole sorting proce ...

Posted by sara_kovai on Wed, 12 Jan 2022 07:28:18 +0100

Graph theory Floyd algorithm and its extended application

1, AcWing 1125 Cattle travel [Title Description] Farmer John's farm has many pastoral areas, and some paths connect some specific pastoral areas. A pastoral area with all the connections is called a pasture. But for now, you can see that at least two pastoral areas are not connected. Now, John wants to add a path to the farm (note that there i ...

Posted by cjl on Wed, 12 Jan 2022 04:06:32 +0100

Data structure --- string

data structure C++ strand Several concepts   substring and main string: the substring s2 composed of any consecutive characters in the string s1 is called the substring of s1, and s1 is called the main string of s2   substring position: the position of the first character of the substring in the main string for the first ti ...

Posted by dink87522 on Wed, 12 Jan 2022 00:05:14 +0100

Data structure and algorithm - binary search tree and its operation and implementation, defects of binary search tree

catalogue 1, Binary search tree 2, Operation and implementation of binary search tree   1. insert data   2. Traversing binary search tree         (1). Preorder traversal         (2). Medium order traversal         (3). Postorder traversal   3. Maximum and minimu ...

Posted by prkarpi on Tue, 11 Jan 2022 15:37:07 +0100