[data structure and algorithm] linked list and bidirectional linked list
Linked list
Like arrays, linked lists can be used to store a series of elements, but the implementation mechanism of linked lists and arrays is completely different
classification
- Unidirectional linked list
- Bidirectional linked list
- One way circular linked list
- Bidirectional circular linked list
Arrays and linked lists
...
Posted by tjodolv on Thu, 06 Jan 2022 12:29:49 +0100
Binary sort tree (implemented in java code) constructs a binary sort tree, traverses the binary sort tree, finds and deletes nodes
Define tree nodes
Define the attributes of tree nodes and the middle order traversal method
class Node {
int value;
Node left;
Node right;
public Node(int value) {
this.value = value;
}
//Medium order traversal
//The result of a binary tree traversed in middle order is ordered
public void infixOrder() { ...
Posted by kawai84 on Thu, 06 Jan 2022 10:34:42 +0100
[data structure and algorithm] hash table
Hashtable
Hash table -- hash table
Hash table is a very important data structure. Almost all programming languages use or indirectly use hash tableIts structure is an array, but its difference from the array is the transformation of the subscript value, which is called the hash function, and the HashCode is obtained through the hash fu ...
Posted by yelvington on Thu, 06 Jan 2022 09:59:35 +0100
Creation and deletion of binary search tree
1, The concept of binary search tree Binary search tree is also called binary sort tree. It is either an empty tree or a binary tree with the following properties: 1. If its left subtree is not empty, the values of all nodes on the left subtree are less than the values of the root node. 2. If its right subtree is not empty, the values of all no ...
Posted by DaveLinger on Thu, 06 Jan 2022 04:12:07 +0100
Data structure in project dependency analysis
Common problems in the project
Source code dependency may lead to mutual direct or indirect dependency to form a ring. How should we quickly detect this?Source code dependency for example, for the large version upgrade of commonLib, we need to release the verification of other aar source codes that depend on the commonLib. How can we quickly o ...
Posted by TechGnome on Thu, 06 Jan 2022 03:43:19 +0100
Dynamic programming problem
Fibonacci
Title Description:
We all know the Fibonacci sequence. Now it is required to input a positive integer n. please output the nth item of the Fibonacci sequence.
Problem solving ideas: 1. Recursion 2. Dynamic planning Status: F(n) State recurrence: F(n)=F(n-1)+F(n-2) Initial value: F(1)=F(2)=1 Return result: F(N)
Code implem ...
Posted by chieffan on Thu, 06 Jan 2022 00:09:22 +0100
Data structure Chapter 6 diagram
//I can also liver again// I can't finish crying
Graph structure is a more complex nonlinear structure than tree structure, and any two terms may be related.
Logical structure of graph
definition
Vertices: data elements in a graph
Graph: it consists of a finite nonempty set of vertices and a set of edges between vertices.
Undirected e ...
Posted by Jene200 on Wed, 05 Jan 2022 20:18:27 +0100
Sword finger offer brush questions 20 minutes (07 16 33)
Sword finger Offer 07 Rebuild binary tree
Enter the results of preorder traversal and inorder traversal of a binary tree, please build the binary tree and return its root node. It is assumed that the input pre order traversal and middle order traversal results do not contain duplicate numbers. This problem uses the idea of recursion. Use pre ...
Posted by riiel on Wed, 05 Jan 2022 17:38:45 +0100
Breadth first search (BFS) and depth first search (DFS)
1, Depth first search (BFS)
1. Introduction
BFS, its full English name is bread first search. BFS does not use rule of thumb algorithms. From the point of view of the algorithm, all child nodes obtained by expanding nodes will be added to a first in first out queue. In general experiments, the nodes whose neighbor nodes hav ...
Posted by wing_zero on Wed, 05 Jan 2022 16:46:51 +0100
Time complexity and space complexity solution (open data structure and algorithm)
Article catalog
1. Algorithm efficiency2. Time complexity3. Space complexity
1.1 algorithm efficiency
There are two kinds of algorithm efficiency analysis: the first is time efficiency and the second is space efficiency. Time efficiency is called time complexity, Spatial efficiency is called spatial complexity. The time complexity main ...
Posted by loweauto on Wed, 05 Jan 2022 12:24:44 +0100