Cache Failure Algorithms
FIFO
First In First Out, first come first. This algorithm removes the earliest data inserted when the queue is full each time new data is inserted.
Easy to implement with LinkedList
package cache;
import java.util.Iterator;
import java.util.LinkedList;
public class FIFO {
LinkedList<Integer> fifo = new LinkedList<Integer>();
in ...
Posted by V0oD0o on Sat, 05 Feb 2022 18:37:04 +0100
[LeetCode 108 binary search tree] convert the ordered array into a binary search tree
1. Title
Give you an integer array nums, in which the elements have been arranged in ascending order. Please convert it into a highly balanced binary search tree.
A height balanced binary tree is a tree that satisfies the requirement that the absolute value of the height difference between the left and right subtrees of each node does ...
Posted by alecapone on Sat, 05 Feb 2022 13:06:54 +0100
NC51 merges k sorted linked lists
NC51 merges k sorted linked lists
Solution 1: use auxiliary array
Traverse each linked list and push the val value of the node into the array arr Sort arr Convert the sorted array into a linked list Return header node head Time complexity: traverse all nodes O(n), sort O(nlogn) Space complexity: use an array with the same length as the ...
Posted by PJSheltrum on Sat, 05 Feb 2022 12:07:20 +0100
Blue Bridge Cup Java -- algorithm training
catalogue
1. Seal
ย 2. Take gold coins
ย 3. Digital game
1. Seal
Problem description
There are n kinds of seals with the same probability of occurrence. Xiao A bought m seals and asked for the probability of collecting n seals.
Input format
Two positive integers n and m in a row
Output format
A real number P represent ...
Posted by littlejay on Sat, 05 Feb 2022 10:56:46 +0100
Dynamic programming -- palindrome string series
1. Longest palindrome substring
2.ย
ย
preface
Dynamic programming palindrome string series has always been a pain point for me. After reading the book this morning, I thought I had fully understood it. As a result, I closed the book and knocked the code in the afternoon. I haven't finished it all afternoon. Alas, sure enough, the code ...
Posted by oscardog on Sat, 05 Feb 2022 10:48:02 +0100
Monotone queue and monotone stack
1, Monotone queue
1. Monotone queue introduction
Monotone queue refers to a data structure in which the elements in a queue have strict monotonicity. It is divided into monotone increasing queue and monotone decreasing queue. Monotone queues satisfy two properties: (1) The monotone queue must satisfy the strict monotonicity from the head ...
Posted by ricroma on Sat, 05 Feb 2022 10:32:20 +0100
Exploration of multiple linear regression
The data is still state Take x77 data set as an example to explore the relationship between a state's crime rate and other factors, including population, illiteracy rate, average income and frost days (the average days when the temperature is below freezing).
Label explanation: Murder crime rate, Population, Illiteracy illiteracy rate, Inc ...
Posted by superhoops on Sat, 05 Feb 2022 10:12:24 +0100
leetcode daily question 1219 Gold miner DFS deep search violence AC on the fifth day of the first month, I wish you a wide range of money~
๐ Content of this article: leetcode daily question 1219 Gold miner DFS deep search violence AC on the fifth day of the first month, I wish you a wide range of money~ ๐ Article column: leetcode daily question "punch in daily" ๐ Last updated: February 4, 2022 leetcode daily question 1725 The number of rectangles that can form th ...
Posted by NeoGeo on Sat, 05 Feb 2022 09:37:45 +0100
[OpenCV complete routine] 90 Frequency domain notch filter
[OpenCV complete routine] 90 Frequency domain notch filter
Welcome to pay attention "100 complete OpenCV routines" Series, continuously updating Welcome to pay attention "Python Xiaobai's OpenCV learning course" Series, continuously updating
5.2 Notch Filter
Notch filter blocks or passes through the frequency in th ...
Posted by dirkdetken on Sat, 05 Feb 2022 01:05:49 +0100
Algorithmic Notes 3.4 Subsection - Introduction Simulation - > Date Processing
A Date Difference
Title Description
There are two dates. Find the number of days between the two dates. If the two dates are consecutive, we specify two days between them.
input
There are multiple sets of data, each with two rows representing two dates in the form of YYYYMMDD
output
Each set of data outputs a row, the date difference ...
Posted by kparish on Fri, 04 Feb 2022 18:12:57 +0100