HashMap source code for a day! put and resize methods can't understand nanny level analysis, I lose!

HashMap is almost a must in the interview. When you ask HashMap, it must be inseparable from the capacity expansion mechanism. If you don't say much, the liver is over. We know that the bottom layer of HashMap is realized by array + linked list. After JDK1.8, red black tree is introduced. This paper analyzes the HashMap after JDK1.8. First, ex ...

Posted by cmancone on Tue, 21 Sep 2021 01:47:07 -0700

Should C + + return an object or a pointer to the object when brushing questions?

This paper only discusses whether to return the object or the pointer of the object when writing algorithm problems in C + +. As we all know, C + + variables are different from java and python. C + + variables are not natural pointers, so the assignment between object type variables is much more time-consuming than java and python. For example ...

Posted by AnnieKay on Mon, 20 Sep 2021 23:04:34 -0700

Stack application - pre -, middle -, and suffix expressions

Infix expression: the operator is between two operandsPrefix expression: the operator precedes the two operands (the left-right order of the two operands cannot be reversed)Suffix expression: operator after two operands Manual calculation method of infix expression to suffix expression: Objectively speaking, the two calculation results are c ...

Posted by karldesign on Mon, 20 Sep 2021 20:40:57 -0700

[graph theory] thinking and Analysis on the difference between Dijkstra algorithm and Spfa algorithm

1, Foreword Dijkstra algorithm and Spfa algorithm are commonly used in the shortest path problem. However, if we learn these two algorithms, we can find that the priority queue optimization of Dijkstra algorithm is very similar to the code of Spfa algorithm. If we do not deeply understand the principles and differences of the two algorithm ...

Posted by BSkopnik on Mon, 20 Sep 2021 18:43:04 -0700

Data structure and algorithm -- linked list

catalogue 1, Single linked list 1.1 basic introduction 1.2 schematic diagram of single linked list logic structure 1.3 adding and deleting data in single linked list (sorted by data number) one point four   Find the penultimate node in the single lin k ed list 1.5 reverse single chain table one point six   Disadvantages of sing ...

Posted by azaidi on Mon, 20 Sep 2021 14:08:44 -0700

Single linked list partial pseudo code

Pseudo code of linked list 1. A recursive algorithm is designed to delete all the nodes with the value of x in the single linked list L without the leading node Writing thought; 1)Establish recursive function and judge each round L->data Is it x,If yes, delete the node, and then L = L->next,Until the end of the linked list is travers ...

Posted by clang on Mon, 20 Sep 2021 10:01:31 -0700

Data structure and algorithm series notes 7: joint search set

Joint search set 1. Union search set concept The parallel query set is a tree type data structure. The parallel query set can efficiently perform the following operations: Query whether element p and element q belong to the same groupMerge the group of element p and element q The parallel query set is also a tree structure, but this tree ...

Posted by codered27 on Mon, 20 Sep 2021 04:24:45 -0700

Data structure and algorithm series notes 3: linear table

Linear table Linear table: a linear table is a finite sequence of n data elements with the same characteristics. Related concepts: Precursor element, successor elementHead node and tail node Linear list classification: sequential list and linked list 1. Sequence table Sequence table: sequence table is a linear table saved in the form of a ...

Posted by upit on Mon, 20 Sep 2021 04:11:38 -0700

Data structure and algorithm - basis - circular linked list (Supplement)

The last issue discussed it as a whole Unidirectional linked list . On this basis, two points are added, one-way circular linked list and two-way circular linked list. It can be seen from the literal that the linked list forms a ring structure. The difference is whether the ring can only cycle in one direction or two directions. One way circu ...

Posted by johnnyblaze1980 on Mon, 20 Sep 2021 01:00:57 -0700

Basic concepts of data structure (C)

1 data structure concept 1.1 origin of data structure Computer from solving numerical problems to solving problems in life Problems in real life involve complex connections between different individuals It is necessary to describe the connections between individuals in life in computer programs Data structure mainly studies the operatio ...

Posted by powah on Sun, 19 Sep 2021 22:35:44 -0700