## [Review] computer hardware and Cache; Array algorithm [bisection, double pointer]

Algorithm training Array topics About the introduction of microservices and distribution, bloggers will take time to continue to share. It is impossible to remember all the knowledge, but it is impossible to have an impression + know the location [then it is not to learn new technology, just remember it at a glance]. In the next pe ...

Posted by kireol on Sat, 09 Apr 2022 18:51:45 +0300

## 1. Sum of two numbers; 15. Sum of three numbers; 18. Sum of four numbers

1. Sum of two numbers; 15. Sum of three numbers; 18. Sum of four numbers 1. Sum of four numbers 1) Title Description Give you an array of n integers, nums, and a target value, target. Please find and return the quads [nums[a], nums[b], nums[c], nums[d]] (if the two Quad elements correspond one to one, it is considered that the two quads are ...

Posted by thepeccavi on Fri, 08 Apr 2022 07:43:29 +0300

## Implementing LRU caching algorithm in Java

1. Introduction to LRU LRU (Least Recently Used) is a common page replacement algorithm. In the calculation, all file operations should be carried out in memory. However, the size of computer memory is fixed, so it is impossible for us to load all files into memory. Therefore, we need to formulate a strategy to select the input of files added ...

Posted by Stiffler on Thu, 07 Apr 2022 13:26:05 +0300

## Skyline, building contour problem

Catalogue of series articles Tip: it may take some time to write a blog, but only when I stand up and write clearly can I understand it clearly. In order to force myself to learn this algorithm and filter out the ideas of problem-solving, I insist on writing! The skyline problem is the title of LeetCode: Original title link: Skyline contour p ...

Posted by rklapwijk on Wed, 06 Apr 2022 17:14:52 +0300

## Time complexity O(n) - level sorting algorithm

Theorem 8.1 of introduction to algorithm: in the worst case, any comparison sorting algorithm needs to make O(nlogn) comparisons. Inference 8.2 of introduction to algorithms: heap sorting and merge sorting are both asymptotically optimal comparative sorting algorithms. Therefore, the time complexity O(n) level sorting algorithms are sorting a ...

Posted by creative on Wed, 06 Apr 2022 16:17:58 +0300

## [leetcode]297. Serialization and deserialization of binary tree

Link: https://leetcode-cn.com/problems/serialize-and-deserialize-binary-tree/ Solution: refer to leetcode and labuladong Difficulty: difficulty /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ public class C ...

Posted by cx3op on Wed, 06 Apr 2022 09:44:12 +0300

## [LeetCode]No.4. Median of Two Sorted Arrays -- Java Version

Title Link: https://leetcode.com/problems/median-of-two-sorted-arrays/ 1. Topic Introduction (combine two arrays to find the median value) Given two sorted arrays nums1 and nums2 of size m and n respectively, return the median of the two sorted arrays. [Translate]: given two ordered arrays nums1 and nums2 with sizes of m and n respectively, ...

Posted by vigiw on Wed, 06 Apr 2022 09:17:06 +0300

## LeetCode brush questions - 4 Find the median of two positively ordered arrays -- binary search

My solution: binary search class Solution { public:     double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {                  if(nums1.size()>nums2.size()){             auto temp=nums1;             nums1=nums2;             nums2=temp;         }         int m=nums1.size();         int n= ...

Posted by Pilli on Tue, 05 Apr 2022 10:39:21 +0300

## Leetcode 654. Maximum binary tree

654. Maximum binary tree Give a non repeating integer array nums. The maximum binary tree can be constructed recursively from nums with the following algorithm: Create a root node with the maximum value in nums. Recursively construct the left subtree on the subarray prefix to the left of the maximum. Recursively construct the right subtree on ...

Posted by vhaxu on Tue, 05 Apr 2022 09:39:51 +0300

## LeetCode algorithm -- recursion + dynamic programming

Day 11 - recursion 77. Portfolio Combination and arrangement are classical recursive backtracking problems, and can be optimized by pruning techniques. Method 1: non pruning recursive backtracking method The combination does not consider the order. M numbers are selected from the given N numbers for combination, and the combined numbers ...

Posted by MajusC00L on Tue, 05 Apr 2022 08:50:12 +0300