Force deduction brush question - array 4
Yang Hui triangle
Topic introduction Train of thought analysis
First of all, we need to understand how the Yang Hui triangle was formed. As shown in the figure, the beginning and end numbers of each layer are 1, and the number of each remaining position is equal to the sum of the number of the corresponding position of its upper laye ...
Posted by abgoosht on Tue, 11 Jan 2022 14:37:51 +0100
LeetCode sort linked list
Give you the head node of the linked list. Please arrange it in ascending order and return the sorted linked list.
Example 1:
Input: head = [4,2,1,3] output: [1,2,3,4]
Example 2:
Input: head = [-1,5,3,4,0] output: [- 1,0,3,4,5]
Example 3:
Input: head = [] output: []
Idea:
At first glance, this problem is to sort the linked ...
Posted by cowboysdude on Tue, 11 Jan 2022 13:06:18 +0100
The second day of algorithm practice in 2022 winter vacation (1.11)
** Preface: prepared by Golang
leetcode
Title: 162 Find peak
Binary decomposition method: time complexity: O(log n), space complexity: O(1) Logic Description: When looking for the peak, because the title says that just look for one. And nums[-1] and nums[len (nums)] are expressed as negative infinity, so the following situations can be cons ...
Posted by MsAngel on Tue, 11 Jan 2022 12:47:41 +0100
Boring weekend, write a minesweeping game in Java
It's boring at the weekend. I wrote a minesweeping program in Java. Speaking of it, it should be fun to write it at school. After all, it's fun to implement a small game by myself. To be honest, the core thing in the minesweeping program can only trigger the step of updating data when clicking.Swing is out of date, but fun won't be out of date. ...
Posted by lihman on Tue, 11 Jan 2022 03:24:49 +0100
Data structure, hash table (note)
1. Hash table
Why is there a hash table?
For example, chestnuts:
There are thousands of employees in a company. How do I find an employee's information
Through the array, each employee corresponds to a job number. I can directly find the job number to obtain the corresponding information
But I don't want to get it through the job num ...
Posted by dean7 on Tue, 11 Jan 2022 02:30:49 +0100
Redis data types and commands and Java usage
Basic data type
Specific details can be accessed directly Redis official website , here is only the command summary
String binary safe stringLists: a collection of string elements sorted by insertion order. They are basically linked lists.Sets: a collection of non repeating and unordered string elements.Sorted sets (ZSets), similar to Sets, b ...
Posted by Rushyo on Mon, 10 Jan 2022 23:01:27 +0100
[data structure] - stack
1, Definition and characteristics
A stack is a linear table that performs insertion and deletion operations only at one end of the table (a linear table refers to a one-to-one relationship between elements rather than sequential storage and chain storage). The operation end is called the top of the stack and the other end is called the bot ...
Posted by Bizzle on Mon, 10 Jan 2022 17:35:01 +0100
LeetCode 707 design linked list -- realize the basic operation of linked list
Source: LeetCode Link: https://leetcode-cn.com/problems/design-linked-list
Design the implementation of linked list. You can choose to use single linked list or double linked list. A node in a single linked list should have two attributes: val , and val , next. Val , is the value of the current node, and next , is the pointer / referenc ...
Posted by apaxson on Mon, 10 Jan 2022 16:05:46 +0100
[beginner's line segment tree, this article must be right] line segment tree (single point modification and interval modification) acm winter vacation training diary 22 / 1 / 10
Segment tree
Segment tree is a data structure commonly used to maintain interval information in algorithm competition. It is a basic and important data structure that an ACMer needs to master. The segment tree can realize single point modification, interval modification, interval query (interval summation, interval maximum value, minimum value ...
Posted by bnownlater on Mon, 10 Jan 2022 15:36:12 +0100
Data structure and linear table
Chapter I overview
Section I overview of data structure
Data structure is a programming discipline that studies non numerical calculation. Nicklaus Wirth, the father of Pascal who won the Turing Award, put forward a famous formula:
Algorithm + data structure = Program
Data structure is a way for computers to store and organize data. A data ...
Posted by Matth_S on Mon, 10 Jan 2022 12:33:48 +0100