Tag:Complexity

  • Complexity of data structure

    Time:2021-9-19

    1、 Algorithm efficiency There are two kinds of algorithm efficiency analysis: 1. Time efficiency Time efficiency is also called time complexity. It mainly measures the running speed of an algorithm. 2. Space efficiency Spatial efficiency is also called spatial complexity. It mainly measures the additional space required by an algorithm. In the early stage of […]

  • Go brush questions every week for the fourth week

    Time:2021-9-16

    Start the leetcode series of dynamic programming. Self supplement related to theoretical knowledge points, old rules, or start with simple topics. Leetcode70 This is an entry-level topic. Find the total number of methods for N steps. When you reach the last step n, there are only two situations, one is from n-1 (one step) and […]

  • Prints nodes between two given level numbers in a binary tree

    Time:2021-9-15

    Given a binary tree and two levels of numbers “low” and “high”, print nodes from low level to high level. For example consider the binary tree given in below diagram. Input: Root of below tree, low = 2, high = 4 Output: 8 22 4 12 10 14 A simple method First, write a recursive […]

  • Leetcode divide and conquer

    Time:2021-9-13

    50. Pow(x, n) Realize pow (x, n), that is, calculate the N-power function of X. Example 1: Input: 2.00000, 10Output: 1024.00000 Example 2: Input: 2.10000, 3Output: 9.26100 Example 3: Input: 2.00000, – 2Output: 0.25000Explanation: 2-2 = 1 / 22 = 1 / 4 = 0.25 explain: -100.0 < x < 100.0N is a 32-bit signed […]

  • Leetcode sword finger offer interview question 30. Stack containing min function

    Time:2021-9-11

    Interview question 30. Stack containing min function This question is the same as leetcode 155: https://leetcode-cn.com/problems/min-stack/ O (1) complexity cannot be achieved without using additional space.Define an additional stack m to store the current minimum value. Reference and detailed analysis: the problem solution of liwei1419 Python solution class MinStack: def __init__(self): “”” initialize your data […]

  • Super detailed sorting algorithm explanation! You can understand at a glance!

    Time:2021-9-4

    The sorting algorithm must be familiar to everyone. As one of the most basic and important algorithms, the classical sorting algorithm is often required to tear the code by hand in the interview. But there are too many sorting algorithms (see the figure below). Some names sound inexplicable, such as cocktail sorting, dwarf sorting, pancake […]

  • Interview question 40. Minimum K number

    Time:2021-9-2

    Interview question 40. Minimum K number Random selection algorithm can be used here. The average time complexity is O (n), and in the worst case, the time complexity is O (n ^ 2). In addition, a more complex bfprt algorithm can be used. The advantage is that the average time complexity and the worst-case time […]

  • Design your Redux data like a database

    Time:2021-9-1

    Crazy technology houseAuthor: Nick sweetingEnglish Title: shape your Redux store like your databaseOriginal English:https://hackernoon.com/shape-…Explanation: this column is first published in the official account: jingchengyideng. Using indexes, you can represent data from multiple dimensions( This should be a moving picture, please see the original text) Recently, when browsing some discussions on JavaScript in the RC chat […]

  • Algorithm – time and space complexity of the algorithm

    Time:2021-9-1

    Time and space complexity of the algorithm Post analysis Disadvantages: the running time of algorithms is different under different data scales and different machines, so it is impossible to calculate the running time Prior analysis Large o time complexity With the increase of N, the running time of the program follows the trend of n […]

  • Doing a good job of microservice architecture is not easy!!

    Time:2021-8-26

    concept Microservices architecture is an architectural style. A large complex software application is composed of one or more microservices. Each microservice in the system can be deployed independently, and each microservice is loosely coupled. Each microservice focuses on completing only one task and completing it well. In all cases, each microservice represents a small business […]

  • Algorithm and data structure series (I) – level differentiated understanding of algorithms

    Time:2021-8-25

    Series articles: Algorithm and data structure series (I) – level differentiated understanding of algorithms Algorithm and data structure series (II) – Basic preparation before implementation Algorithm and data structure series (III) – select sort Algorithm and data structure series (IV) – insertion sorting method – insert sort Algorithm and data structure series (V) – improvement […]

  • One article takes you to AC four questions [bit operation]

    Time:2021-8-23

    Here I have summarized several problems of bit operation, which are 136, 137260 and 645 respectively. A total of four problems are added up. All the four questions are the routines of bit operation. If you want to practice bit operation, don’t miss it Appetizer Before we start, let’s learn about XOR, which we’ll use […]