Algorithm and data structure

1, Algorithm ++n n + + differences int n=1,n1,n2; n1=++n; System.out.println(n1); System.out.println(n); n2=n++; System.out.println(n2); System.out.println(n); 2 2 2 3 1. Concept Philosophy of writing algorithms: From simple to complex: verify step by step and print more intermediate results Part first and then whole: subdivide when ...

Posted by hiprakhar on Fri, 03 Dec 2021 00:00:07 -0800

Sorting through Lambda expressions

Data sorting in memory First, we define a basic class, and then we will demonstrate how to sort in memory according to this basic class. @Data @NoArgsConstructor @AllArgsConstructor public class Student { private String name; private int age; @Override public boolean equals(Object o) { if (this == o) { ...

Posted by binit on Thu, 02 Dec 2021 22:22:46 -0800

1, Array_ Prefix and array_ 304. Two dimensional area and retrieval - the matrix is immutable

Title Description Given a two-dimensional matrix, multiple requests of the following types: Calculate the sum of the elements within its sub rectangle. The upper left corner of the sub matrix is (row1, col1) and the lower right corner is (row2, col2). Implement the NumMatrix class: NumMatrix(int[][] matrix) initializes the given integer matri ...

Posted by alco19357 on Thu, 02 Dec 2021 15:28:36 -0800

R language combat Topsis comprehensive evaluation method

This paper introduces Topsis comprehensive evaluation method, illustrates its calculation process through a practical case, and realizes it by using R language. 1. Overview of TOPSIS method The full name of TOPSIS is technology for order preference by similarity to an ideal solution. TOPSIS method was first proposed by C.L.Hwang and K.Yoon ...

Posted by sgs on Thu, 02 Dec 2021 12:48:33 -0800

Chapter 3 stack and queue

Chapter 3 stack and queue Stacks and queues are linear tables that restrict inserts and deletions to the "end" (end) of the table That is, stacks and queues are subsets of linear tables (linear tables with restricted insertion and deletion positions) Stack features: first in, last out Queue characteristics: first in first out 3.1 ...

Posted by lrdaramis on Thu, 02 Dec 2021 07:59:54 -0800

leetcode: 145. Post order traversal of binary tree

1: Recursive implementation void endTraversal(struct TreeNode *root,int *ret,int *returnSize) { if(root)//If the tree is not empty, it will traverse, and if it is empty, it will end { endTraversal(root->left,ret,returnSize);//Postorder traversal of left subtree endTraversal(root->right,ret,returnSize);//Postorder ...

Posted by the_924 on Wed, 01 Dec 2021 17:24:49 -0800

leetcode essence of algorithm interview in Dachang 13. Monotone stack

leetcode essence of algorithm interview in Dachang 13. Monotone stack Video Explanation (efficient learning): Click to learn catalog: 1. Introduction 2. Time and space complexity 3. Dynamic planning 4. Greed 5. Binary search 6. Depth first & breadth first 7. Double pointer 8. Sliding window 9. Bit operation 10. Recursion & d ...

Posted by Jyotsna on Wed, 01 Dec 2021 14:41:11 -0800

Mining Guarantee Community Pattern Analysis Based on Neo4j

I. Preface For guaranteed customer group, how to conduct detailed analysis and mining on the guaranteed customer group type? As shown in Figure 1, how do I get the label and how do I label it? Figure 1: Sample Diagram Using graph technology, you can label the triangle directly. Algorithmic steps Guarantee association data cleaning; ...

Posted by hcoms on Wed, 01 Dec 2021 13:42:04 -0800

ACM essential template - Number Theory

number theory Prime table Number of prime numbers with length i cnt [ 1 ] = 4 cnt [ 2 ] = 21 cnt [ 3 ] = 143 cnt [ 4 ] = 1061 cnt [ 5 ] = 8363 cnt [ 6 ] = 68906 cnt [ 7 ] = 586081 Prime table within 1000 2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97 101 103 107 109 113 127 131 137 139 149 151 157 163 167 17 ...

Posted by deeem on Wed, 01 Dec 2021 13:14:09 -0800

Leetcode|greedy algorithm [allocation + interval] (135|435|455...)

Greedy Algorithm The simple understanding is to ensure the local optimization, the local results are irrelevant, and the results are the simple summation of the local optimal results to achieve the global optimization. assignment problem 455. Distribute cookies [Assign Cookies (Easy)] Title Description Suppose you are a great par ...

Posted by keyur.delhi on Wed, 01 Dec 2021 06:45:03 -0800