leetcode brush record day002:189 and 217

189. Medium difficulty: the content refers to the official answer Think of the array as a ring connected end to end. Moving right is equivalent to rotating the ring Requirements: 1. Use the in-situ algorithm with spatial complexity O(1) to solve this problem; 2. There are at least three different ways to solve this problem Problem solving ide ...

Posted by dunnsearch on Fri, 17 Sep 2021 04:04:11 +0200

Data structure - array

Arrays are everywhere. When you need more than one data transmission or display, you will use arrays. Now let's start with the definition. array define An array is a group of data, as shown in: [1,3,5,7] Copy code In JavaScript, array elements can be of any type, but generally, a set of data of the same type is more common and meaningful. ...

Posted by saandel on Fri, 17 Sep 2021 01:27:38 +0200

Algorithm notes Chapter 4 ~ 5

Chapter IV Hashtable A brief introduction to hash table 1) Hash table can be understood as a collection structure at the use level 2) If there is only key and no accompanying data value, you can use the HashSet structure (unorderderdedset in C + +) 3) If there are both key s and accompanying data value s, you can use the HashMap str ...

Posted by chiefmonkey on Thu, 16 Sep 2021 22:12:21 +0200

Educational codeforces round 112 (rated for Div. 2)

A. PizzaForces A. PizzaForces Easy to understand, omitted Idea: simply be greedy. Divide n into such forms as n=10+x+10y, then 10y individuals use y large cakes, and the remaining 10+x uses three combinations of cakes to see which saves the most time AC_code: #include<bits/stdc++.h> using namespace std; typedef long long ll; int main( ...

Posted by jola on Thu, 16 Sep 2021 02:35:10 +0200

Step by step, red and black trees in Java

Red-black tree is one of many "balanced" search tree patterns, and in the worst case, its associated operation is O(log n). 1. Properties of red and black trees A red-black tree is a binary lookup tree. Unlike ordinary binary lookup trees, each node of a red-black tree has a color attribute whose value is either red or black. By re ...

Posted by TalonFinsky on Tue, 14 Sep 2021 22:49:34 +0200

ES6-Generator and Asynchronous Application

Introduction to Generator Functions Basic conceptsGrammatical understandingDefinition Formal UnderstandingBasic examples Association between Generator and iteratoryield statement Notes on using yield statementsComparison of yield and return statements yield*statement yield* +Generator function without returnyield* +Generator function w ...

Posted by devinemke on Sun, 12 Sep 2021 18:15:42 +0200

Algorithm design and analysis -- backtracking method

Algorithm design and analysis -- backtracking method © 1, Backtracking method 1. Definition In the solution space tree containing all solutions of the problem, according to the depth first search strategy, search the solution space tree from the root node (start node). When the backtracking method searches the solution space, two strat ...

Posted by focus310 on Sun, 12 Sep 2021 05:37:48 +0200

Data structure -- logical thinking and code analysis of double linked list

1, Double linked list There is only one pointer to its successor in the single linked list node, so that the single linked list can only traverse backward from the first node in turn. To access the predecessor node of a node (during insertion and deletion operations), you can only traverse from the beginning. The time complexity of access ...

Posted by gottes_tod on Sat, 11 Sep 2021 23:14:56 +0200

python implementation of Huffman tree and tree structure visualization

Preface The principle of the Huffman tree and its python implementation: Q's knowledge blind spot in the recent interview, only remember the noun does not know its meaning. After three years of work, what you learned during the entrance examination for postgraduate studies is basically returned to the teacher. In addition to the list wor ...

Posted by D3xt3r on Sat, 11 Sep 2021 18:27:02 +0200

2021-9-7 299. Number guessing game (Hash Table + secondary traversal, bucket + primary traversal)

Note: Title: You are playing balls and cows with your friends. The rules of the game are as follows: You write a secret number and ask your friend to guess what the number is. Every time a friend guesses, you will give him a hint to tell him how many digits in the guessed number belong to the number and the exact position are guessed correctl ...

Posted by dzm on Fri, 10 Sep 2021 11:17:57 +0200