Whether two linked lists intersect

Given the head nodes headA and headB of two single linked lists, please find and return the starting node where the two single linked lists intersect. If two linked lists have no intersection, null is returned. Note: there may be rings in the chain structure. First, judge whether a single linked list is a ring. Given a linked list, return the ...

Posted by pchytil on Mon, 24 Jan 2022 02:13:02 +0100

HashMap introduction, that is, part of the source code analysis

brief introduction Introduction to HashMap HashMap is an implementation of Map interface based on hash table, which is used to store key value pairs. Due to the implementation of Map interface, HashMap allows null to be used as key and value, which is the same as other ordinary key values, that is, null can be used as the value of multiple ke ...

Posted by ranman on Mon, 24 Jan 2022 00:21:33 +0100

Looking at the source code step by step: HashMap container source code series 3 (its 1, data structure, put method, tree method)

Hashmap Underlying data structure: jdk1 7 hash table (array + linked list), jdk1 8 array + linked list / red black tree. Here I'll introduce it in detail. Of course, if you want to understand the evolution of the tree, you can see my next article. Let's start with the data structure: Underlying data structure Hash table Let's take a look at ...

Posted by iamtheironman on Sun, 23 Jan 2022 21:50:21 +0100

In depth understanding of data structure -- binary tree (basic chapter)

Recently, I started to learn go. The company also arranged some corresponding exercises, including those related to binary tree. I happened to pick up some knowledge points in this regard In the computer data structure, we often come into contact with the typical nonlinear data structure of tree. The following picture shows a standard tree stru ...

Posted by kid85 on Sun, 23 Jan 2022 19:30:36 +0100

Note: PAT-B1032 - which is the best excavator technology

PAT-B1032 - which excavator technology is better Title (20 points) In order to prove which excavator technology is better, PAT organized an excavator skills competition. Now please count the school with the strongest technology according to the competition results. input Enter a positive integer N that does not exceed 10 * * 5 on line 1, th ...

Posted by pbarney on Sun, 23 Jan 2022 17:07:10 +0100

01 knapsack problem of classical problem of dynamic programming

Problem description Give you a backpack with a weight of W and N items. Each item has two attributes: weight and value. The weight of the ith item is wt[i] and the value is val[i]. Now, what is the maximum value you can pack with this back package? Problem solving ideas 01 knapsack problem is a very classic dynamic programming problem, ...

Posted by tinuviel on Sun, 23 Jan 2022 13:19:17 +0100

High paid programmer & interview question series 59 what is half search? Talk about the code implementation of binary search method

I Interview questions and analysis 1. Today's interview question What search and insert algorithms do you know? What is half search? Talk about the code implementation of binary search method 2. Topic analysis Today's topic is mainly to investigate our mastery of commonly used algorithms in development, especially search algorithms ...

Posted by dark_destroyer on Sun, 23 Jan 2022 12:35:14 +0100

Sword finger - tree chapter (C + +)

Tree article Question 1: depth of binary tree Enter a binary tree and find the depth of the tree. The nodes (including root and leaf nodes) passing from root node to leaf node form a path of the tree. The length of the longest path is the depth of the tree, and the depth of the root node is regarded as 1. Data range: the number of nodes ...

Posted by dlester on Sun, 23 Jan 2022 10:11:20 +0100

Sword finger offer (C + +) -- linked list collection

This series of notes is for self-study algorithm. It only records the problem solving code and some problem solving ideas. All topics are copyrighted by LeeCode and sword finger offer; We recommend a great series of blog for brushing questions and taking notes, which can be used as a reference for the classification of questions in this series: ...

Posted by vcarter on Sun, 23 Jan 2022 07:00:44 +0100

Insert sorting algorithm summary -- with JAVA language implementation

Before introducing the algorithm, I will first introduce you to a very useful website. The visualization process inside can help you better understand the data structure and algorithm VISUALGO.NET: https://visualgo.net/zh. Visualization process: The following contents are explained in three aspects: the idea, characteristics and implemen ...

Posted by technotool on Sun, 23 Jan 2022 05:45:24 +0100