Sorting algorithm and optimization
preface
Internal sorting: the sorting of data stored in memory External sorting: sorting data stored on external memory (such as disk and hard disk) Seven sorts are based on comparison, and three sorts are based on non comparison.
1, Bubble sorting
1. Bubble sort is a stable sort. The idea is that traversing the array is to compare two ...
Added by Tsukasa on Sun, 23 Jan 2022 03:06:08 +0200
-This article gives you a thorough understanding of arrays and their extended data structures, fast transpose algorithms, etc
published: true date: 2022-1-22 tags: 'algorithm and data structure'
array
This chapter mainly introduces the basic concept and extension of array, and the storage decoupling of special matrices of two-dimensional array: symmetric matrix, triangular matrix, sparse matrix, cross linked list, etc; Then the fast transpose algorithm of sparse ...
Added by ProTec on Sat, 22 Jan 2022 18:53:58 +0200
[PAT (Basic Level) Practice] - [Two Pointers] 1035 insert and merge
I. [Topic difficulty]
Class B
II. [Title No.]
1035 insertion and merging (25 points)
III. [Title Description]
According to the definition of Wikipedia: Insertion sorting is an iterative algorithm, which obtains the input data one by one and gradually produces an orderly output sequence. In each iteration, the algorithm takes an element ...
Added by Jona on Sat, 22 Jan 2022 16:51:22 +0200
List < T > to tree
Baidu Encyclopedia recursion Description:
The programming skill of the program calling itself is called recursion. Recursion as a algorithm stay Programming language Widely used in. A process or function In its definition or description, there is a method that directly or indirectly calls itself. It usually transforms a large and complex ...
Added by ermajn on Sat, 22 Jan 2022 16:04:09 +0200
Kiner algorithm: deep search (DFS) and wide search (BFS): first understanding the problem state space (hand tearing algorithm)
Guide to series of articles
Guide to series of articles
Open source project
All articles in this series will be included in GitHub for unified collection and management. Welcome ISSUE and Star.
GitHub portal: Kiner algorithm
preface
After understanding the core concept of search algorithm, knowing what problem solving tree is, and masteri ...
Added by scottb1 on Sat, 22 Jan 2022 15:38:33 +0200
Leetcode question brushing - Summary of one question per day
Catalogue of series articles
Find traversal
169. Most elements
subject Given an array of size n, find most of its elements. Most elements refer to elements that appear more than ⌊ n/2 ⌋ in the array.
You can assume that the array is non empty and that there are always many elements in a given array.
Example 1:
In ...
Added by keane7 on Sat, 22 Jan 2022 13:32:43 +0200
NOIP2012] cultural tour - (search question)
Link: https://ac.nowcoder.com/acm/problem/16577 Source: niuke.com
Title Description There is a messenger who wants to travel around countries. Every time he goes to a country, he can learn a culture, but he is unwilling to learn any culture more than once (that is, if he learns a culture, he can't reach other countries with this culture). Diff ...
Added by jimdy on Sat, 22 Jan 2022 06:57:38 +0200
acwing week 6
An undirected connected graph consisting of n points and m edges is given.
We want to turn it into a complete graph through a series of operations (that is, each pair of different vertices has exactly one edge connected).
During each operation, you can select one of the points, find all the points directly connected to it, and connect the ed ...
Added by marian on Sat, 22 Jan 2022 04:46:18 +0200
Wonderful sorting operation
In the second part, let's write some wonderful sorting operations.
1, Bucket sorting
When we sort a string of numbers, what method should we use? There are many kinds, bubble sort, bucket sort, quick sort, sort The first one is to introduce bucket sorting.
What is bucket sorting?
We now have six numbers 6 5 7 9 1 4. We're going to sort him? ...
Added by GaryE on Sat, 22 Jan 2022 04:26:13 +0200
Blue Bridge Cup practice
Twelfth
Exercise link
Weight weighing
The first thing I thought of was the direct explosion search. The result only passed the example, and the complexity should be
n
!
n!
n!, So it's time-out.
int a[N],vis[N],n;
int ok[100010];
int sum; ...
Added by Shuriken1 on Sat, 22 Jan 2022 04:18:14 +0200