Tag：Complexity

Data structure and algorithm (implemented by golang) (22) sorting algorithm Hill sorting
Shell Sort In 1959, a man namedDonald L. Shell (March 1, 1924 – November 2, 2015)American inCommunications of the ACMA sorting algorithm has been published, and the algorithm named Hill sorting has been born. Note:ACM = Association for Computing MachineryInternational Computer Society, a worldwide professional organization of computer practitioners, was founded in 1947. It is […]

leetcode501. Find Mode in Binary Search Tree
Title Requirements Given a binary search tree (BST) with duplicates, find all the mode(s) (the most frequently occurred element) in the given BST. Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than or equal to the node’s key. The right subtree of a node […]

Data structure and algorithm (implemented by golang) (24) sorting algorithm priority queue and heap sorting
Priority queue and heap sort Heap sort（Heap Sort）By Welsh Canadian computer scientistJ. W. J. Williamsstay1964Invented in, it uses a binary reactor(A binary heap)And the availability of binary heap data structure is proved. In the same year, American computer scientistR. W. FloydBased on the research of tree sorting, an improved and better heap sorting version is […]

CTR learning notes & code implementation 1prelude to deep learning LR – > FFM
The first part of CTR learning notes series summarizes the classic LR, FM and FFM models before the depth model became the king. These classic models are also used as components for various depth models later. The model is implemented by the userdefined keras layer and estimator respectively, ha ha is an old love and […]

Data structure and algorithm (implemented by golang) (25) sorting algorithm – fast sorting
Quick sort Fast sorting is a sort algorithm of divide and conquer strategy, which is developed by British computer scientistsTony HoareThe algorithm is published in1961OfCommunications of the ACM。 Note:ACM = Association for Computing MachineryInternational Computer Society, a worldwide professional organization of computer practitioners, was founded in 1947. It is the first scientific and educational computer […]

Redis3.2 source code analysis – jump table zskiplist
Jump table is one of the underlying implementations of redis Zset. When there are many members in Zset, jump table will be used as the underlying implementation. It has the same performance as red black tree in adding, deleting and finding nodes. In fact, it is a kind ofSpecial listEach node of the linked list […]

[leetcode algorithm weekly] issue 3
The first official account is WeChat’s public front growth story. 2019.11.13 background This paper records the whole thinking process in the process of writing questions for reference. The main contents include: Assumption of topic analysis Write code validation Consult others’ solution Thinking summary catalog 35. Search insertion location 38. Report 53. Maximum suborder sum 58. […]

Dynamic array of data structure
1、 Introduction Using java language, a simple dynamic array is realized based on Java Native array, which has the basic functions of expanding and shrinking, as well as the basic functions of adding, deleting, modifying and checking. 2、 Coding implementation /** *Dynamic array, Java Native array secondary encapsulation */ public class Array<E> { /** *A […]

[leetcode algorithm weekly] issue 4
The official account of WeChat’s public front growth story is written in 2019.11.21. background This paper records the whole thinking process in the process of writing questions for reference. The main contents include: Assumption of topic analysis Write code validation Consult others’ solution Thinking summary Catalog 67. Binary sum Square root of 69. X 70. […]

34. Find the first and last positions of elements in the sorting array
Given an ascending array of integers, nums, and a target value, target. Find the start and end position of the given target value in the array. Your algorithm time complexity must be o (log n) level. Returns [ 1, – 1] if the target value does not exist in the array. Example 1: Input: nums […]

Beauty of discovery algorithm – time complexity
I have been working for 3 years and want to write more elegant code. So recently, I have been brushing leetcode to supplement my knowledge of data structure and algorithm. Although I have learned in school, I only have a general understanding. Only after several years of practical work can we understand the data structure […]

Leetcode0001 sum of two numbers
Title address: https://leetcodecn.com/problems/twosum/ 1. Violent solution Direct double cycle, all possible solutions are given. The time complexity is O (n ^ 2), and the space complexity is O (1) var twoSum = function(nums, target) { for (let i = 0; i < nums.length; i++) { for (let j = i + 1; j < nums.length; […]