Stay Hungry, Stay Foolish. — Steve Jobs

The algorithm,

  • Big O notation

The running time of the algorithm is expressed in big O notation. When we talk about the speed of an algorithm, we’re talking about how fast the running time increases as the input increases.

  • ❑ O(log n), also known as logarithmic time, such algorithms include binary search.
  • ❑ O(n), also known as linear time, such algorithms involve simple lookups.
  • ❑ O(n * log n), including quicksort, a faster sorting algorithm, described in Chapter 4.
  • ❑ O(n2), such algorithms include selective sorting, a slower sorting algorithm, described in Chapter 2.
  • ❑ O (n! Such an algorithm includes a very slow solution to the traveling salesman problem described next.
  1. Binary Search

To quickly find an element in an ordered list of elements, use binary lookup. Guess the middle number so that you can rule out half the wrong answers every time. The number of steps required for binary lookup is log2n. (The logarithmic concept, the larger the number, the more efficient it is to use binary search.)

  1. Recursive recursion

It’s a cleaner, easier to understand algorithm than a loop (while). Call your own function that takes an argument and returns a value;

  • Base case if

  • Recursive case else condition

  1. Divide and Conquer

Is a way to find the Greatest Common Divisor (GCD), simplify the complexity. D&C for short, start by finding simple baseline conditions. Then step by step reduce the size of the problem to fit the baseline.

  • Euclidean Algorithm

Divide with the divisor and remainder repeatedly, when the remainder is 0, take the divisor of the current formula as the greatest common divisor.

  • Dijkstra Algorithm

To calculate the shortest path in an unweighted graph, use breadth-first search. To calculate the shortest path in a weighted graph, the Dikstra algorithm can be used. (Also known as shortest path algorithm.)

  1. Our lines First Search (BFS)

When we need to determine a shorterst-pathproblem, we first (1) use graphs to model the problem. (2) Use breadth-first search to solve problems. The search scope gradually extends outward from the starting point, that is, first check the first degree relationship, then check the second degree relationship.

— — — – 6/18

  1. Depth First Search
  2. Backtracking Backtracking
  3. Two Pointers
  4. Dynamic Programming
  5. Scan line algorithm
  6. Quick Sort (important D&C)

First, you select an element from the array, which is called the pivot value.

Second, data structure

  1. Call Stack

Push in and eject; The return address used to store the subroutine

  1. Queue Queue

  2. List Linked List

Each element stores the address of the next, similar to a treasure hunt map or friends willing to sit apart at a movie theater. Linked lists are efficient when they read elements in order, because the previous element always contains the address of the next element. But if you need to access some elements randomly, an array is a more straightforward way to do it.

  1. An Array of Array

It’s like choosing a seat at a movie theater. You don’t know how many friends will show up, but make sure you’re in the same row. When there are a lot of friends, it is easy to have seats where there are not so many people connected together, so you need to move. So to avoid trouble, the computer has to reserve enough seats (that is, memory), but not enough to meet unexpected friends, leading to the risk of being wasted.

To sum up, it is faster to insert and delete lists of elements, and faster to read an array of elements.

  1. Hash Table Hash Table
  2. Binary Tree
  3. Heap Heap
  4. And look up the set Union Find
  5. The dictionary Trie tree

Three, HTML

  1. div

Four, CSS,

5. JavaScript

JavaScript is a programming language that belongs to HTML and the Web. HTML defines the content of a web page; CSS specifies the layout of a web page; JavaScript programs the behavior of web pages.