PAT class a 1119 pre - and post order Traversals

PAT class a 1119 pre - and post order Traversals Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and inorder traversal sequences, or preorder and inorder traversal sequences. However, if only the postorder and preorder traversal sequences are given, ...

Posted by highjo on Sat, 04 Dec 2021 16:05:14 -0800

leetcode-97. Interleaved string

subject Link: https://leetcode-cn.com/problems/interleaving-string Given the three strings s1, s2 and s3, please help verify whether s3 is composed of s1 and s2 interleaving. The definition and process of interleaving two strings s and t are as follows, in which each string will be divided into several non empty substrings: s = s1 + s2 + ... ...

Posted by devil6600 on Sat, 04 Dec 2021 15:28:37 -0800

Algorithm intermediate learning 3

1, Fibonacci formula (matrix method, fast power) /** * @Author: Gao Yubo * @Date: 2021/11/27 20:47 */ public class Fibonacci { public static void main(String[] args) { System.out.println(getFibonacci1(20)); System.out.println(getFibonacci2(20)); } public static int getFibonacci1(int N) { if (N == 1) { ...

Posted by giba on Sat, 04 Dec 2021 14:34:33 -0800

Python learning 2 -- DBSCAN clustering algorithm

1, Principle Reference blog: Python implementation of DBSCAN clustering algorithm_ Xu Yi's column - CSDN blog_ dbscan pythonhttps://blog.csdn.net/xyisv/article/details/88918448 DBSCAN is a density based clustering algorithm. This kind of density clustering algorithm generally assumes that the category can be determined by the tightness of sam ...

Posted by carleyvibe on Fri, 03 Dec 2021 22:18:06 -0800

CDQ divide and conquer

I'm just learning cdq divide and conquer today. I'd like to write a little summary. First of all, we can see that this name is related to divide and conquer. The prefix name is actually not so important. After studying all morning, I feel that this thing is added to the merge Directly look at the most template topic, flowers bloom on the street ...

Posted by RaythMistwalker on Fri, 03 Dec 2021 20:16:00 -0800

LeetCode kickoff week 269

Weekly portal The ranking is 131. It has been quite stable recently~ 2089. Find the target subscript after array sorting Idea: traversal, counting Time complexity: O ( n ) \mathcal{O}(n) O ...

Posted by ThermalSloth on Fri, 03 Dec 2021 18:56:01 -0800

P1352 SSL 1607 party without boss (chain forward star)

Title Description: Title portal Problem solving ideas: According to the meaning of the question, this question is to select several points on a tree to maximize the point weight, in which the selected points meet two conditions: If the parent node is selected, the child node cannot be selectedIf a child node is selected, the parent node c ...

Posted by kir10s on Fri, 03 Dec 2021 18:38:00 -0800

#Introduction to PyTorch build MLP model to realize classification tasks

  this is the second article on the introduction to PyTorch. It will be continuously updated as a series of PyTorch articles.   this paper will introduce how to use PyTorch to build a simple MLP (Multi-layer Perceptron) model to realize two classification and multi classification tasks. Data set introduction   the second classi ...

Posted by nepeaNMedia on Fri, 03 Dec 2021 14:11:19 -0800

Javascript high-order techniques [array]

Javascript high-order techniques [array] 1. Fastest generation of list of [1,2,3,..., n] It is very fast to generate numbers by using the subscript index of the list Array(10).fill(true).map((x,i)=>i+1); > (10) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] It can also be seen that Array(n).fill(1) can be used to quickly build a list with length n; ...

Posted by cirko on Fri, 03 Dec 2021 08:29:32 -0800

Violent recursive attempt

1: Hanoi Tower problem Interview question 08.06. Hanoi Tower question LeetCode (LeetCode CN. Com)https://leetcode-cn.com/problems/hanota-lcci/ class Solution { public: void zhuanYi(int i,vector<int>&from,vector<int>&other,vector<int>&to){ if(i==1){int ding=from.back();from.pop_back();to.push_back(ding);} ...

Posted by GaryE on Fri, 03 Dec 2021 04:19:20 -0800