Basic problems of binary tree in classic force deduction

preface: The vast majority of binary tree problems can be solved by recursion. Mastering the first, middle and last sequence traversal and sequence traversal of binary tree is the basis for quickly solving binary tree problems. catalogue preface: Maximum depth of binary tree Idea: code: Same tree Idea: code: Symmetric binary tree Ide ...

Posted by Disgone on Fri, 28 Jan 2022 19:27:45 +0100

Heard that reverse thinking can reduce time complexity?

Starting with the end means setting goals first and then making plans in daily life. I learned this concept when I read management books before.In the algorithm, taking the end as the beginning refers to pushing back from the result to the initial state of the problem.So when is it appropriate to think in reverse? A very simple principle is:The ...

Posted by sitestem on Fri, 28 Jan 2022 19:22:38 +0100

A Leecode every day - find the median of two positive arrays and share with Tencent high-frequency interview questions!

Find the median of two positively ordered arrays Method 1: binary search Given two ordered arrays, it is required to find the median of two ordered arrays. The most intuitive ideas are as follows: Using the merging method, merge two ordered arrays to get a large ordered array. The element in the middle of a large ordered array is the median. ...

Posted by moonshaden on Fri, 28 Jan 2022 17:59:01 +0100

2021-06-20 current account savings management system

Current account savings management system of data structure linked list (C + +) Current savings account management system 1 question content and purpose requirements (1) Structural background Linked list is a data structure of linked storage. It uses a group of storage units with arbitrary address to store the data elements in the linear lis ...

Posted by ricardo.leite on Fri, 28 Jan 2022 17:41:59 +0100

Detailed explanation and summary of the real topic of the 12th Blue Bridge Cup Java group B provincial competition in 2021 [the first provincial competition 2021.04.18]

Detailed explanation and summary of the real topic of the final of the Java group B provincial competition of the Blue Bridge Cup [Topic download, 2013 (4th) ~ 2020 (11th)] CSDN Blue Bridge Cup column Detailed explanation and summary of the real topic of the 04th Blue Bridge Cup Java group B provincial competition in 2013Detailed explanatio ...

Posted by Wolphie on Fri, 28 Jan 2022 16:44:21 +0100

Take you hand in hand to disassemble the LRU algorithm

Take you hand in hand to disassemble the LRU algorithm summary LRU algorithm is a cache elimination strategy. The principle is not difficult, but it is more skilled to write bug free algorithms in the interview. It needs to abstract and disassemble the data structure layer by layer. labuladong in this paper will write you beautiful code. ...

Posted by lakshmiyb on Fri, 28 Jan 2022 15:25:20 +0100

C + + PTA a1098 (insert heap sort)

According to Wikipedia: Insertion sort iterates, consuming one input element each repetition, and growing a sorted output list. Each iteration, insertion sort removes one element from the input data, finds the location it belongs within the sorted list, and inserts it there. It repeats until no input elements remain. Heap sort divides its inp ...

Posted by kayess2004 on Fri, 28 Jan 2022 15:02:11 +0100

Test questions and solutions of the 13th Blue Bridge Cup (phase III) C++

Test questions and solutions of the 13th Blue Bridge Cup Simulation Competition (phase III) 1. Question A [problem description] What is the decimal system corresponding to the hexadecimal number 2021ABCD? Number system conversion A ~ F in hexadecimal indicates 10 ~ 15. Finally, use% x placeholder to output hexadecimal for checking //Answe ...

Posted by drdokter on Fri, 28 Jan 2022 14:25:09 +0100

Introduction to ISLR statistical learning: R language code practice of linear regression

Chapter 2 linear regression 2.1 simple linear regression The ISLR2 library contains the Boston dataset, which records medv (median house value) for 506 census districts in Boston. We will use 12 predictive variables, such as rmvar (average number of rooms per household), age (average house age), and lstat (percentage of households with low so ...

Posted by fleymingmasc on Fri, 28 Jan 2022 14:19:24 +0100

Knapsack problem of dynamic programming (java)

1, Dynamic programming   Dynamic Programming (DP) is a branch of operations research, which is the process of solving the optimization of decision-making process. 2, Basic thought    (1) divide the large problem into small problems to solve, so as to obtain the optimal solution step by step;    (2) the dynamic progra ...

Posted by devilincarnated on Fri, 28 Jan 2022 14:00:55 +0100