Quick sorting algorithm
Quicksort is an improvement of bubble sort algorithm.
1. Sorting process
The quick sort algorithm realizes sorting through multiple comparisons and exchanges. The sorting process is as follows: (1) First, set a boundary value, and divide the array into left and right parts through the boundary value. (2) Collect data greater than or equal ...
Posted by silvercover on Tue, 19 Oct 2021 18:58:02 -0700
Heap sorting of graphical sorting algorithm
Preparatory knowledge
Heap sort
Heap sort is a sort algorithm designed by using the data structure of heap. Heap sort is a selective sort. Its worst, best, average time complexity is O(nlogn), and it is also an unstable sort. First, simply understand the lower heap structure.
heap
Heap is a complete binary tree with the following pro ...
Posted by I Am Chris on Tue, 19 Oct 2021 12:36:51 -0700
Front end "N Queen" recursive backtracking
/*
@Author: yang@Date: 2021-09-27 19:40:34@LastEditors: yang@LastEditTime: 2021-10-19 19:57:43@FilePath: \demo \ breadth first traversal. js */
Front end "N Queen" recursive backtracking classical problem
Let's look at the problem first. In fact, the problem is not difficult to understand: The n queen problem studies how to place n ...
Posted by Octave91 on Tue, 19 Oct 2021 11:19:09 -0700
Queue summary LinkedBlockingQueue
LinkedBlockingQueue
Blocking queue is one of the common implementations of BlockingQueue interface. It is an optional (queue length can be manually specified) bounded blocking queue based on linked list
public class LinkedBlockingQueue<E> extends AbstractQueue<E>
implements BlockingQueue<E>, java.io.Serializable {
...
Posted by A584537 on Tue, 19 Oct 2021 10:51:02 -0700
Data Structure Experimentation Report - Merging Algorithm of Two Ordered Linear Tables
1. Contents and requirements of the experiment:
1. Create two ordered linear tables from keyboard input (input data of each linear table is entered in order from smallest to largest, regardless of sorting algorithm); Output the two ordered linear tables; Merge the two ordered linear tables into an ordered linear table. The output is a merged o ...
Posted by Tryweryn on Tue, 19 Oct 2021 09:26:54 -0700
Java blocking queue LinkedBlockingDeque
LinkedBlockingDeque
The LinkedBlockingDeque class implements the BlockingDeque interface. Read the BlockingDeque text for more information about.
Deque comes from the word "double ended queue". Deque is a queue where you can insert and delete elements at both ends of the queue.
LinkedBlockingDeque is a Deque. If a thread tries to g ...
Posted by macmonkey on Mon, 18 Oct 2021 19:02:47 -0700
Data structure STL -- implementation of comparator by golang
github address: GitHub - hlccd/goSTL
Comparator
summary
For some data structures with size comparison, it is very cumbersome to implement some size comparison every time. Especially for some officially set types, it will be simple to implement the comparison of their elements when introducing basic types into the data structure.
At the s ...
Posted by Richter on Mon, 18 Oct 2021 15:48:26 -0700
Conversion between data structure Map and other data types in ES6
preface
Hello, guys. In the previous article, we shared the Map data structure in ES6 in detail. This article will make a supplement to Map on the basis of the previous article. There is another knowledge about Map that has not been shared, that is, the mutual conversion between Map and other types.
Through the study of the previous artic ...
Posted by Mohit_Prog on Mon, 18 Oct 2021 12:08:46 -0700
python learning records - tuples and sets
1. Tuples
What is tuple
Tuple: One of Python's built-in data structures is an immutable sequence
Example:
t = ( 'python' , 'hello' , 90 )
Variable and Invariant Sequences
Invariant sequence: string, tuple
No add, delete, change operations for immutable sequences Variable sequence: list, bullet, set
Variable sequences c ...
Posted by crwtrue on Sun, 17 Oct 2021 10:31:10 -0700
Sword finger offer -- the nearest common ancestor of the binary tree (binary search tree + binary tree with pointer to parent node + ordinary binary tree)
Give you a binary tree and two nodes in the binary tree, and find the nearest common ancestor of the two nodes. Nearest common ancestor: "for two nodes p and q with root tree root, the nearest common ancestor is expressed as a node a, which satisfies that a is the ancestor of p and q, and the depth of a is as large as possible (a node can ...
Posted by surfinglight on Sun, 17 Oct 2021 10:22:11 -0700