Blue Bridge Cup prime
Title 1525: Blue Bridge Cup algorithm to improve VIP prime
time limit: 1Sec Memory limit: 128MB Submit: 2503 solve: 347
Title Description
Given interval[L, R] , Please calculate the number of primes in the interval.
input
Two numbers L and R.
Data scale and agreement
2 < = L < = R < = 2147483647
R-L < = ...
Added by Johannes80 on Fri, 11 Feb 2022 04:02:33 +0200
Sorting algorithm and binary search algorithm
1. Bubble sorting
Bubble sorting principle:
1) Compare two adjacent elements. If the preceding element is larger than the following element, exchange the two numbers. After the first traversal, the maximum number will be placed at the last position of the array, that is, array[length - 1]. 2) The last element is skipped during the second trav ...
Added by blindtoad on Thu, 10 Feb 2022 22:27:00 +0200
Linked list intersection of java data structure and algorithm
Intersection of two unidirectional linked lists
Problem Description:
There are two one-way linked lists. They may or may not intersect. If it intersects, it returns the intersecting node; if it does not intersect, it returns null.
There are only three cases when two one-way linked lists intersect.
The problem of linked list intersection is ...
Added by soniared2002 on Thu, 10 Feb 2022 19:01:03 +0200
Heap, comparator, cardinality sort
1, Heap and related operations
Heap structure is a complete binary tree structure implemented by array size refers to the number of nodes I position, left child 2i+1, right child 2i+2, parent node (i-1)/2 rounded downIn a complete binary tree, if the maximum value of each subtree is at the top, it is a large root heapIn a complete binary t ...
Added by wee493 on Thu, 10 Feb 2022 16:49:47 +0200
Implementation and application of parallel search set
Let's take a look at the definition given by Du Niang:
And look up the set. In some set application problems with N elements, we usually make each element form a single element set at the beginning, and then merge the sets of elements belonging to the same group in a certain order. In the meantime, we should repeatedly find out which set an ...
Added by safrica on Thu, 10 Feb 2022 11:56:23 +0200
C + + implements the related algorithms of data structure and algorithm -- stack and queue
Implementation of stack and queue related algorithms
In the process of learning data structure and algorithm, in order to better understand the implementation of the algorithm, this paper implements the algorithms of stack and queue in the course. This article only provides algorithm code reference. For detailed explanation of relevant algorit ...
Added by czambran on Thu, 10 Feb 2022 07:41:56 +0200
Data structure - Basic Concepts
1. What is a data structure
1.1 some definitions of data structure
"A data structure is a data object and the various relationships between the instances of the object and the data elements that make up the instance. These relationships can be given by defining relevant functions." Sartaj Sahni, data structure, algorithm and App ...
Added by poe on Thu, 10 Feb 2022 06:18:04 +0200
Dynamic programming 3: continuous subarray class problem
Current topic
53. Maximum subarray and
918. Maximum sum of circular subarrays
152. Product maximum subarray
1567. Longest subarray length with positive product
53. Maximum subarray and
The common feature of several topics in this issue is to find a continuous array in an array to maximize the goal. We start wit ...
Added by garfx on Thu, 10 Feb 2022 04:42:20 +0200
BUAA (spring 2021) minimum wiring (diagram) -- Prim(BFS + greed) + Kruskal (parallel search set) double solution + principle explanation
Notice before reading
Key points introduction and brief statement.
The seventh computer question is be ing updated
Topic content
Problem description
The main office and scientific research buildings of Beihang include new main building, Yifu Building, such as heart building, office building, library, main building, building 1, etc;. Be ...
Added by NewbieBryan on Thu, 10 Feb 2022 01:24:51 +0200
[data structure and algorithm] basic oj exercise of binary tree
1. Single valued binary tree
– oj link Solution:
1. Judge whether the value of the left child of the root is the same as the root node. 2. Judge whether the value of the right child of the root is the same as the root node. 3. Judge whether the binary tree with the left child of the root as the root is a single valued binary tre ...
Added by liquid79 on Thu, 10 Feb 2022 01:07:25 +0200