Brush questions every day Day13
Question 1: the next larger element I The next larger element of the number x in nums1 refers to the first element larger than x to the right of the corresponding position of X in nums2. Give you two arrays nums1 and nums2 without duplicate elements. The subscript counts from 0, where nums1 is a subset of nums2. For each 0 < = I < nums1 L ...
Posted by sniped22 on Wed, 26 Jan 2022 03:03:15 +0100
Data structure - circular queue
4.2. Implementation of circular queue function
Cyclic queue characteristics
In order to make full use of vector space and overcome the phenomenon of "false overflow", the method is to imagine vector space as a ring with head and tail connected, and call this vector cyclic vector. The queue stored in it is called Circular Queue. C ...
Posted by imamferianto on Tue, 25 Jan 2022 22:30:49 +0100
[C + +] [hash table] [hash function] implement its own hash table to solve hash conflicts; Dynamic Hash table;
preface
1. Introduction of hash table and hash function
Just like this problem, with a 26 int array, you can hash map each character.
The hash function is: f(char) = char -'a '; The hash table is the int [26];
This simple hash function handles the conversion from key to index, and it is also a simple one-to-one correspondence.
The m ...
Posted by homer.favenir on Tue, 25 Jan 2022 21:20:43 +0100
Weekly leetcode - NC13/NC70/NC62/NC73/NC112/NC96/NC34/62/NC57/7/NC16/NC25/237/82/NC9/NC55
simple
Niuke Tiba - NC13 maximum depth of binary tree
Find the maximum depth of a given binary tree. Depth refers to the number of nodes on the path from the root node of the tree to any leaf node. The maximum depth is the maximum depth of all leaf nodes.
public class Solution {
public int maxDepth (TreeNode root) {
if(root== ...
Posted by tarlejh on Tue, 25 Jan 2022 18:37:53 +0100
Linear discrete storage linked list in data structure
In the previous section, we have learned about continuous storage in linear storage. We also call this storage structure sequential table or array. We also know that linear continuous storage has the following advantages and disadvantages:
Advantages: it can quickly add and access elementsDisadvantages: inserting or deleting elements will mo ...
Posted by JustinMs66 on Tue, 25 Jan 2022 15:39:16 +0100
Java collections in simple terms
Java collections in simple terms
1. Overview of collection framework
Sets and arrays are structures that store multiple data, referred to as Java containers for short.
Note: storage at this time mainly refers to memory level storage, and does not involve persistent storage (. txt,.jpg,.avi, in the database)
Array features in storing multipl ...
Posted by verbalkint81 on Tue, 25 Jan 2022 12:00:41 +0100
Thinking in C + +: STL algorithm
Thinking in C + + > STL algorithm summary notes.
STL algorithm directory
0. Algorithm overview
fill(), assign value to each element of [first, last].fill_n(), n elements starting from first are assigned value.generate(), use the generator to generate a value for each element of [first, last].generate_n() generates a value for the n el ...
Posted by Gayner on Tue, 25 Jan 2022 07:28:40 +0100
[data structure and algorithm] in-depth analysis of the solution idea and algorithm example of "deleting duplicates in ordered arrays"
1, Title Requirements
Give you an ordered array nums, please delete the repeated elements in place, make each element appear only once, and return the new length of the deleted array.Do not use additional array space. You must modify the input array in place and complete it with O(1) additional space.explain:
Why is the returned value an in ...
Posted by priya_amb on Tue, 25 Jan 2022 05:27:06 +0100
Binary tree recursive routine: judge whether it is a full binary tree and the number of nodes of the largest sub search binary tree
Today, continue the recursive routine of binary tree.1, Determine whether it is a full binary treeFull binary tree definition: for a binary tree with height h, the number of nodes is (2^h - 1)1. Recursive routine ideaAccording to the definition of full binary tree, we only need to obtain the height and the number of nodes each time.That is, we ...
Posted by elementaluk on Tue, 25 Jan 2022 04:46:06 +0100
2034. Stock price fluctuation (medium hash table ordered set priority queue)
1332. Delete palindrome subsequence
Give you a data stream of stock prices. Each record in the data stream contains a time stamp and the price corresponding to the stock at that time point.
Unfortunately, due to the inherent volatility of the stock market, stock price records may not come in chronological order. In some cases, some records ma ...
Posted by zyntax on Tue, 25 Jan 2022 00:12:01 +0100