The most detailed source code analysis for HashMap and Concurrent HashMap of Java base collection classes
HashMap Source Analysis
HashMap is a common key-value collection implementation class in Java that implements the Map interface.
data structure
Core:
The whole is an array;Each position of the array is a chain list (or a red-black tree);The Value in each node of the list is the Object we store;
JDK 1.7
data structure
Array+Chain List
...
Added by plapeyre on Fri, 19 Nov 2021 19:55:24 +0200
This paper solves all search backtracking problems of sword finger Offer
1. Sword finger Offer 32 - I. print binary tree from top to bottom
Sword finger Offer 32 - I. print binary tree from top to bottom
Idea: use the queue to traverse the hierarchy
class Solution {
public int[] levelOrder(TreeNode root) {
if(root==null)
return new int[0];//When root is null, return []
A ...
Added by trent2800 on Wed, 17 Nov 2021 07:25:26 +0200
Sequential storage structure and chain storage structure of linear table and their simple operation (mixed use of C and C + +)
Sequential storage structure and chain storage structure of linear table and their simple operation (mixed use of C and C + +)1, Preface:In the first computer experiment when learning data structure, the teacher asked us to realize the sequential storage structure and chain storage structure of linear table and their simple operation. It was pa ...
Added by Axem on Fri, 12 Nov 2021 17:25:38 +0200
Data structure and algorithm -- jump table
What is a jump watch
The full name of jump list is jump list. It allows you to quickly query, insert and delete a data linked list of ordered and continuous elements. The average search and insertion time complexity of the jump list is O(logn). Fast query is performed by maintaining a multi-level linked list, and the elements in each layer of ...
Added by ginger76 on Fri, 12 Nov 2021 07:06:04 +0200
A tree array entry to advanced implementation principle + detailed explanation of code template
1, What is the of a tree array
We first need to understand what a tree array is. A tree array is a data structure. Its main function is to efficiently realize interval summation and single point modification. We can know that the most efficient interval summation is computation Prefix and Array thus
O
...
Added by ace21 on Wed, 10 Nov 2021 19:34:01 +0200
Note: data structure - Chapter 4
Chapter IV string
4.1 string
A String is a finite sequence of zero or more characters For example: S = "Hello World!"; Double quotation marks (Java, C) are used in some places; Use single quotation marks where necessary (Python) Substring - composed of any consecutive characters; Main string - a string containing substrings Em ...
Added by Michan on Wed, 10 Nov 2021 19:02:20 +0200
Time complexity - select sort - bubble sort - insert sort - dichotomy - XOR operation - recursive behavior and time complexity
1, Time complexity
Constant time operation
If an operation has nothing to do with the data volume of the sample and is completed within a fixed time each time, it is called Changshu operation. For example, int a = arr[i] at this time, it is only to find the offset in the array and the number of I position. This is a constant operation, in ...
Added by adksga on Wed, 10 Nov 2021 18:04:43 +0200
Data structure experiment
1. Experimental topic
There is only one narrow passage for n cars in the parking lot, and only one gate for cars to enter and exit. The cars in the parking lot are arranged from north to south according to the sequence of vehicle arrival time (the gate is at the southernmost end, and the first car arriving first is par ...
Added by lowspeed on Tue, 09 Nov 2021 04:13:19 +0200
Linear table -- dynamic sequence table
preface
This chapter introduces the storage elements in the data structure - the sequential table in the linear table
Linear table
A linear list is a finite sequence of n data elements with the same characteristics. Linear table is a data structure widely used in practice. Common linear tables: sequential table, linked list, stac ...
Added by vegnadragon on Mon, 08 Nov 2021 10:18:29 +0200
Implementation and Application of Heap (TOPK Problem and Heap Sorting)
1. Definition of heap
A heap is a special kind of complete binary tree in which the father node must be greater than or equal to its child node (this is called a heap) or the father node must be less than or equal to its child node (this is called a heap).
_The so-called complete binary tree is a kind of binary tree whose nodes are arrang ...
Added by Dragoonus on Sun, 07 Nov 2021 18:44:46 +0200