7-7 create a binary tree for pre order sequence, output pre order sequence, middle order sequence and post order sequence, and output the number of leaf nodes (20 points)
I feel that I haven't learned the part of the tree very well. PTA encountered this problem and didn't write it out at first. After writing it, I found that it's actually very simple. Record it.
In fact, what I learned is the process of writing this question
That is, if you modify a structure with typedef, you can't define the structure variab ...
Posted by webosb on Thu, 10 Mar 2022 14:33:12 +0100
Introduction notes of Niuke algorithm competition 5
Finally, the line segment tree and tree array. Let's send a little bit first. Please look forward to more questions.
Briefly describe the segment tree:
What is a segment tree? In fact, it is an interval data structure. It looks like a tree, but each node maintains the attributes of a certain interval. The root node maintains the entire inte ...
Posted by son.of.the.morning on Thu, 10 Mar 2022 08:57:35 +0100
Data structure and algorithm IV. queue
1, Queue
Like a stack, a queue is a linear structure that follows a specific order in which operations are performed. The order is first in first out (FIFO).
Queue structure is actually a linear structure. If further divided from the storage structure of data, the queue structure includes two types.
・ sequential queue structure: that is, a ...
Posted by cwiddowson on Thu, 10 Mar 2022 05:44:25 +0100
Project C - book borrowing system
Title: book borrowing system Function: the system requires the following functions: 1. Administrator mode: manage book information and customer information; 2. Customer mode: complete customer borrowing query requirements. 3. Addition, deletion, modification and query function: complete the addition, deletion, modification, query and display of ...
Posted by outsidaz on Wed, 09 Mar 2022 21:34:06 +0100
[data structure - C implementation] sequence table
catalogue
1. Linear table
2. Sequence table
2.1 concept of sequence table
2.2 interface
3. Interface implementation
3.1 tail insertion of sequence table
3.2 # sequential header insertion
3.3 # insert data at the specified location
3.4 delete the end of the sequence table
3.5 deletion of sequence header
3.6 delete data at the spec ...
Posted by sith717 on Wed, 09 Mar 2022 17:17:26 +0100
Binary tree learning
Terms of binary tree
Node: an element in a tree Child node: the root of each subtree of a node Parent node: the opposite concept of child node Sibling node: a child node with the same parents Ancestor node: both parent nodes from the root node to this node become ancestor nodes Descendant node is the opposite concept of ancestor node De ...
Posted by mikevarela on Wed, 09 Mar 2022 15:22:23 +0100
Linked list of data structure
Single linked list
Little prince single linked list
One day, the little prince was fascinated by the game of queuing. There were 10 toys numbered 1-10 placed in order on the table. Now the little prince wants to place them according to his preferences. The little prince selects a beautiful toy from among them and puts it in the front of all t ...
Posted by kannu on Wed, 09 Mar 2022 14:19:21 +0100
Stack structure review (pathfinding problem)
I wrote it a long time ago, the sixth blog of newcomers
The default direction is to walk to the right (0) from (1,1). When preparing to walk to the right, first calculate the coordinates of the landing point after walking to the right, that is, (1,2), and then judge whether (1,2) is a wall (judge whether it is 0). If it is a wall, change the d ...
Posted by witt on Wed, 09 Mar 2022 12:18:01 +0100
Challenge program design: codeforces round #776 (Div. 3) g. counting shortcuts
Title portal
Main idea of the title:
Given an undirected graph G without self ring and mu lt iple edges, as well as the starting point and end point S and T, the edge weight is 1, find the path length from S to T < = the number of shortest path length + 1.
Problem solving ideas
Since the edge weight length is constant as 1, the shortest ...
Posted by ThEMakeR on Wed, 09 Mar 2022 10:18:26 +0100
Algorithm backtracking method
Full Permutation (leetcode_46)
subject
Given a sequence without repeated numbers, all possible permutations are returned.
Example:
Input: [1,2,3] Output: [ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1] ]
Problem solution
The backtracking method solves the problem. i exchanges with first to generate a new sequence, and constructs a ...
Posted by xpherism on Tue, 08 Mar 2022 22:38:47 +0100