Summary of a series of questions about house raiding

1. House raiding thinking Conventional dynamic programming problems ① dp[i] means the maximum amount of money to steal the ith house ② Recursion dp[i]=max(dp[i-1], dp[i-2]+nums[i]) is actually to find the maximum amount of the ith house, that is, either steal the house or not. If you steal, the previous one cannot be stolen, that is, find t ...

Posted by ehask on Sun, 24 Oct 2021 03:18:56 -0700

JAVA cultivation script Chapter 11: sorting, there is no best and most complete, only better and more complete

Previous period: JAVA cultivation script Chapter 1: Painful torture JAVA cultivation script Chapter 2: Gradual demonization JAVA cultivation script Chapter 3: Jedi counterattack JAVA cultivation script Chapter 4: "Closed door cultivation" JAVA cultivation script Chapter 5: "Sleeping on firewood and tasting gall" JAVA cultiva ...

Posted by Steven_belfast on Sun, 24 Oct 2021 01:34:00 -0700

And maximum string (C language)

And maximum string (C language) Reference blog: https://www.cnblogs.com/activeshj/p/4090817.html Problem description Give you an integer array, in which the elements have positive, negative and 0. You are required to find a continuous substring. The sum of all elements of the substring is the largest of all continuous substrings. Examp ...

Posted by dennismcdougall on Sun, 24 Oct 2021 01:12:11 -0700

Krypton binary

Binary Title Description You are an algorithm enthusiast, trying to learn computer knowledge. You know, the most beautiful part of the computer is binary, which you have a deep experience in shape pressure plus o. of course, binary is also very clever when used in co and o, not to mention that nini games can be related to xor. T oday, you ...

Posted by Rigo on Sun, 24 Oct 2021 00:55:43 -0700

Agent model of design pattern

Proxy pattern is one of the most widely used design patterns. For example, aop in spring is the practice of proxy pattern. Generally, the dynamic proxy mode is widely used in java, and the common implementation methods are jdk dynamic proxy and cglib dynamic proxy. Implementing dynamic proxy with jdk Using jdk to implement dynamic proxy code ...

Posted by zxiny_chin on Sun, 24 Oct 2021 00:02:25 -0700

The stock is valued by DCF model

The value of a stock is equal to the discounted value of its future cash flow. ——Stock market rules 1, Foreword DCF(Discounted Cash Flow) is the abbreviation of discounted cash flow method, which can evaluate stocks. At present, most stock API s on the Internet only provide simple daily quotes, which is far from enough for analy ...

Posted by RogerInHawaii on Sat, 23 Oct 2021 20:48:00 -0700

Java data structure and algorithm

catalogue recursion The concept of recursion Recursive call mechanism Print problem code   Operation results Factorial problem     Operation results Explanation of recursive call mechanism ​ Recursive call rule What kind of problems can recursion solve What kind of problem is recursion used to solve   Importan ...

Posted by trystan on Sat, 23 Oct 2021 07:37:06 -0700

October 23, 2021 (weekly summary)

        This week, I mainly brush some dp questions. Finally, if I want to brush according to the topic, I'll start with the backpack. Today, I don't see the question for the first time. I solved a backpack question in the provincial competition last year. I'm still very excited. At least I didn't learn in vain. It's still ...

Posted by tjmbc on Sat, 23 Oct 2021 04:57:28 -0700

Heap structure and heap sorting

Heap (priority queue) Time complexity: The time complexity of initializing heap building is O(n) Heap sort rebuild heap O(nlogn) PriorityQueue small top heap Small top heap: the weight of any non leaf node is not greater than the weight of its left and right child nodes Constructor constructor Function introductionPriorityQueue()Create a ...

Posted by rajeevbharti on Sat, 23 Oct 2021 03:06:30 -0700

< data structure Zhejiang University > 03 tree isomorphism of 1 tree (25 points)

      Give two trees T1 and T2. If T1 can be changed into T2 by several times, we call the two trees "isomorphic". For example, the two trees given in Figure 1 are isomorphic, because we exchange the left and right children of nodes A, B and G of one tree to get the other tree. Figure 2 is not isomorphic. ...

Posted by desoto0311 on Sat, 23 Oct 2021 01:31:11 -0700