PTA: save 007 (upgraded) (30 points)
Title:
In the old movie "Live and Let Die", there is a plot in which 007 is caught by a drug dealer on an island in the center of an crocodile pool. He uses an extremely bold way to escape - directly stepping on the brain bags of a series of crocodiles in the pool and jumping ashore! (it is said that the stuntman was bitten by ...
Posted by heropage on Sun, 28 Nov 2021 10:37:26 -0800
Merge and sort: solve the problem of small sum and reverse order pairs
1, Small and problems
1. Title Description:
In an array, the numbers on the left of each number that are smaller than the current number are added up, which is called the small sum of the array. Find the small sum of a given array.
2. Example:
The array is: [1,3,4,2,5]
1 the number smaller than 1 on the left: No
3 the number smaller than ...
Posted by porco on Sun, 28 Nov 2021 10:30:33 -0800
Circular linked list and bidirectional linked list
1, Foreword
The sequential storage structure of linear table (such as array) has continuous storage space, so we don't have to worry about the logical relationship between elements. The biggest advantage of linear table is that it can quickly access the elements at any position in the table. The disadvantage of linear table sequential storage ...
Posted by tonchily on Sun, 28 Nov 2021 10:17:26 -0800
Depth first traversal of adjacency table and adjacency matrix (with code debug and detailed comments)
Attach the program effect first:
Adjacency table:
Adjacency matrix, that is, a two-dimensional array is used to store the relationship between each vertex and the corresponding edge. For example, if there are edges between two vertices, set the subscript corresponding to this two-dimensional array to a non-zero value. As shown below: Undirec ...
Posted by airdee on Sun, 28 Nov 2021 05:30:10 -0800
Stack and queue Title Records
Recorded on November 28, 2021
Next up was the last blog post on stacks and queues Stack and queue title record (I)
232. Implement queue with stack
Idea: this topic is a simulation problem to investigate the understanding of stack and queue.
Because the stack is Filo (can only enter and pop up at the top of the stack), and the queue is FIFO ...
Posted by jkraft10 on Sun, 28 Nov 2021 05:27:16 -0800
Ten thousand people and one thousand problems plan-39
preface
The front is the solution given by brother hero today. The back binary tree is your own content. Just look at it according to your own needs
Recommended community: ten thousand people and one thousand questions
Today's solution
The number of statistical digits is even
Idea: According to the division by 10 method, the correspond ...
Posted by stan801003 on Sun, 28 Nov 2021 03:27:06 -0800
Top ten classic sorting: merge sorting | bucket sorting
Merge sort
Merge sort principle
What is merge sort? To merge and sort, we must first understand what is merging: merging two ordered sequences into one ordered sequence, which we call "merging".
Idea: merge sort is to sort the sequence of numbers by using the idea of merge. According to the specific implementation, merge sortin ...
Posted by dlcmpls on Sun, 28 Nov 2021 03:08:06 -0800
Recursive algorithm design
Definition of recursion: in the process of calling a function, the function itself is called directly or indirectly, which is called the recursion call of the function. This function is called the recursive function. If the p function is called in the p function definition, it is called direct recursion. If the q function is called in the p fun ...
Posted by designxperts on Sun, 28 Nov 2021 00:26:14 -0800
4014 - solution of simple path with length k based on adjacency table (C + +, with ideas)
describe
A connected graph uses adjacency table as storage structure. An algorithm is designed to judge whether there is a simple path with length k at any given two points in an undirected graph.
input
Multiple groups of data, each group of m+3 data rows. The first line has two numbers n, m and k, representing n vertices, m edges and length ...
Posted by vitorjamil on Sat, 27 Nov 2021 23:32:48 -0800
[classical sorting algorithm] 1-bubble sorting
1. Bubble sorting idea
The idea of bubble sorting is to compare two numbers from the first number and exchange them in reverse order. After a comparison, the largest number will be exchanged to the last, that is, the largest number will sink to the bottom, which is similar to the largest bubble at the bottom of the pool (on the contrary, t ...
Posted by eneyas on Sat, 27 Nov 2021 22:10:33 -0800