Sorting algorithm is a basic algorithm in computer science, and it is widely used at the same time. python functions also have built-in sorting interfaces, such as the sorted function. In actual production, the sorting algorithm we use in different scenarios will be slightly different. The selection of sorting algorithm mainly considers the ...

Posted by jamesp on Wed, 11 May 2022 22:16:52 +0300

(2) Queue
definition
Similar to a stack, a queue is also a special linear table, and the difference from an array is also reflected in operations such as additions and deletions. The insertion operation of the queue can only be performed at the end of the queue, and the deletion operation of the queue can only be performed at the head of the ...

Posted by cobnut on Wed, 11 May 2022 07:58:00 +0300

preface
Questions that need to open vip will be skipped temporarily
Note navigation
Click the link to jump to the navigation link of all brush notes
401. Binary Watch
The top of the binary watch has 4 LEDs representing hours (0-11) and the bottom 6 LEDs representing minutes (0-59).
Each LED represents a 0 or 1, with the lowest bit on ...

Posted by CodeMama on Tue, 10 May 2022 15:53:22 +0300

1. Background
In the development process, it is inevitable to maintain a set of data, and be able to add, delete, modify and check quickly. If the amount of data is large and needs to be persistent, choose the database. However, if the amount of data is relatively small, does not need persistence, and requires high response time, it is most ap ...

Posted by kolanos7 on Tue, 10 May 2022 14:03:36 +0300

Dynamic programming of leetcode brush questions
The following are some questions about dynamic programming brushing questions summarized in July and August.
Substring and Subsequence Problems
First, substrings and subsequences
Substrings need to be continuous, subsequences need not be continuous, and dynamic programming can be used here.
Abcd-- ...

Posted by SundayDriver on Tue, 10 May 2022 07:44:36 +0300

Clue binary tree
This paper refers to the data structure of Dahua
principle
For a binary list with n nodes, each node has a pointer field pointing to the left and right children, so there are 2n pointer fields in total. The binary tree with n nodes has a total of n-1 branches, that is, there are 2n-(n-1)=n+1 empty finger needle fields. ...

Posted by Satria Ox41464b on Sun, 08 May 2022 08:35:18 +0300

catalogue
Title Description
Backtracking solution
Title Description
Title address: https://leetcode-cn.com/problems/generate-parentheses/
Given that n represents the logarithm of the generated parentheses, please write a function so that it can generate all possible and effective parenthesis combinations. For example, given n = 3, the gen ...

Posted by sundawg on Sat, 07 May 2022 22:48:58 +0300

Binary tree
Definition of binary tree
A binary tree is a finite set of nodes (recursively defined) ① This set is either empty; ② Or it is composed of a root node and two disjoint binary trees called left subtree and right subtree.
Five basic forms of binary tree
Difference between binary tree and quadratic tree
① Different degrees
A tre ...

Data structure - linked list
Three, five, seven words
Don't let data structures become the ceiling
Relevant code address
concept
Linked list is not only a linear structure, but also a natural recursive structure. Linked list structure can make full use of computer memory space and realize flexible dynamic memory management. However, the link ...

Posted by Tentious on Fri, 06 May 2022 20:26:15 +0300

Binary tree implementation
//Node class of tree
public class TreeNode<T> {
//Store data
public T data;
//Point to left child and right child nodes
public TreeNode<T> left,right;
public TreeNode(T data, TreeNode<T> left, TreeNode<T> right) {
super();
this.data = data;
this.le ...

Posted by Ambush Commander on Fri, 06 May 2022 08:18:21 +0300