Using C + + to realize linked stack (with linked list as the underlying data structure)
1. What is a chain stack?
Since the allocation of each element in the stack in memory is not continuous, the connection between elements is realized through a pointer in each element node. As shown below: It can be seen that the head of the linked list is used as the top of the stack.
2. Comparison between sequential stack and chain stac ...
Added by social_experiment on Sat, 12 Feb 2022 05:52:15 +0200
In-depth Analysis of Data Structure and Algorithms Solving Ideas and Algorithmic Examples of Disturbing Strings
1. Title requirements
Using the algorithm described below, you can scramble the string s to get the string t:
If the length of the string is 1, the algorithm stops.
If the length of the string is > 1, perform the following steps:
Split a string into two non-empty substrings at a random subscript. That is, if the string s is ...
Added by phbock on Fri, 11 Feb 2022 20:21:41 +0200
[data structure algorithm] - C language
The data structure algorithm implemented in C language is explained one by one below:
(Swap function is a transposition function at the end, which can be understood)
1. Insert sorting
As the name suggests, a value is inserted one by one from the front. When inserting, it is sorted once. If there are n numbers, it is sorted n times
Th ...
Added by tomharding on Fri, 11 Feb 2022 20:18:56 +0200
Analysis of the underlying mechanism and source code of HashMap
Analysis of the underlying mechanism and source code of HashMap
1. Schematic diagram:
1. < K, V > is to use HashMap$Node to realize map Entry<K,V>. 2. The bottom layer of HashMap is JDK7 0 is implemented in [array + list]. jdk8. After 0, it will be realized by [array + list + red black tree]. When the list reaches a certain leng ...
Added by naitsir on Fri, 11 Feb 2022 14:24:31 +0200
[Java basic dry goods] analysis of ArrayList source code
All the code in this article comes from jdk1 eight
Introduction to ArrayList
public class ArrayList<E> extends AbstractList<E>
implements List<E>, RandomAccess, Cloneable, java.io.Serializable
ArrayList inherits AbstractList and implements list, randomaccess, Cloneable, Java io. Serializable interface
java.lang.Ob ...
Added by stickman373 on Fri, 11 Feb 2022 13:48:22 +0200
AVL tree - balanced binary tree
catalog:
I Concept & principle
Previously, we understood the binary search tree, but we found that if the data is orderly or close to orderly, the binary search tree will degenerate into a single tree
AVL tree is a balanced binary tree. It just adds a balance factor to the binary search tree to form the current balanced bi ...
Added by cbrknight on Fri, 11 Feb 2022 13:19:17 +0200
Honorable Course in Data Structure - First Experimentation Solution Report
1. Repeat Count
subject
In a limited sequence of positive integers, some numbers repeat several times. Please count the number of occurrences of each number, and then output the number and its number in the order where the number first appears in the sequence. Output format: A number of rows, two separated by a space in each row. The firs ...
Added by thepriest on Fri, 11 Feb 2022 11:48:53 +0200
Graph analysis (coduck)
catalogue
Concept of graph
Storage mode of graph
adjacency matrix
Title: adjacency matrix representation of Graphs
Adjacency table
Title: the forward star of a graph represents 1
ergodic
Depth first search
Breadth first search
Shortest path algorithm
Dijkstra algorithm
Title: Party
Bellman Ford algorithm
SPFA algorithm
Title: ma ...
Added by siwelis on Fri, 11 Feb 2022 11:00:02 +0200
Data structure algorithm design problem
Linear table
1. The linear table with known length n adopts sequential storage structure. Write an algorithm to delete all elements with the value of x in the linear table. Method 1: record the number of elements equal to X in the sequence table l with k, count k while scanning L, move the elements not equal to x forward k positions, and fina ...
Added by nahla123 on Fri, 11 Feb 2022 08:53:06 +0200
Array and sparse matrix
catalogue
1, Definition of array
1. Definition of one-dimensional array
2. Definition of two-dimensional array
2, Storage structure of array
1. Array storage mode
2. Storage mode of two-dimensional array
(1) Priority storage by row
(2) priority storage mode by column
3, Matrix
1. Definition of matrix
2. Definition of special matrix ...
Added by artyfarty on Fri, 11 Feb 2022 08:37:41 +0200