Knowledge of pseudocode and flowcharts, including abstract concepts, logic, data structures.

1. Abstract concepts

It’s not the syntax that’s hard to program. It’s the abstractions. Sometimes we understand every sentence, but not the sum of them.

Programming languages can also be abstracted. There is no great difference between different programming languages. JS, Python, Java, and PHP have many similar concepts.

Declare the if... else... The function objectCopy the code

This means that there is no need to pay too much attention to the details of the language, but to first understand the invariability of the language, and then to adapt to change.

Second, the logic

All programming uses logic

1. What is logic

// There are seven types of data: stirng, number, bool, symbol, undefined, null, objectCopy the code
// All functions in JS are constructed by Function. // All functions in JS are constructed by Function. // All functions in JS are constructed by FunctionCopy the code

2. Logic vs. intuition

The benefits of intuition: Intuition allows you to quickly learn things like numbers, strings, arrays, and objects

The downside of intuition: Your intuition can prevent you from learning something else, so you have to rely on logic to convince yourself, for example, you don’t know how Function is constructed, but logic tells you that it is

3. Express logic in pseudocode

Example 1 – Print the larger of the two numbers

// if the first number is greater than the second, print the first number // otherwise print the second number a[12,32]if a.get(0) > a.get(1)
    print a.get(0)
else
    printAtul gawande et (1) / / if... else... Can represent logicCopy the code

Example 2 – Print the largest number of N numbers

// Find the larger of the first and second digits and store it in Max // Find the larger of the first and third digits and store it in Max // Find the larger of the second and third digits and store it in Max // Find the larger of the second and third digits and store it in Max... Max a[12 32,9,1,23,6] Max = a[0]for i from 1 to a.length() - 1
    if a.get(i) > max then max = a.get(i)
printMax / /forLoops can represent logicCopy the code

How many statements does it take to represent logic? You can express all the logic if you master these statements

4. Three statements to get all the logic

This is the theory of “structured programming,” but structured programming can become cumbersome in certain situations, such as error handling, where a fourth statement, goto, may be required

1. Execute statements sequentially

Statement 1 statement 2Copy the code

2. Conditional statement

if... then... else... if... else if... elseCopy the code

3. Loop statements

wihile... do...for i from 1 to n...
Copy the code

The benefit of flowcharts and pseudocode is to exercise your brain and organize your thoughts

Data structure

Data structure is the relationship and structure between data

1. Give examples

How do I represent two pieces of data

If the order makes sense: (x, y) said the first one is x, the second is the y coordinate is such data, for example, to provide the first and the last operation -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- meaningless if order: (x,y) is the same as (y,x) for example, blood pressure (120,80) is the same as blood pressure (80,120). There is no need to provide first and last operationsCopy the code

How do I represent N numbers

Said if the order makes sense: array (a1, a2,... aN) to provide the index operation get (I), to provide the add/indexOf/delete -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- meaningless if order: The set represents {a1, A3... AN} provides add/delete/has operationsCopy the code

How to represent N to N data (e.g. student number)

Let's call it a hash tablehash= {1001 = >'small parties', 1002 = >'little red'}
Copy the code

2. Role of data structures

Data structure = data form + operation

Don’t you think it’s abstract? Different forms of data expose different operations, data structures are abstract

Keep some structures in mind ahead of time: These are common structures that will help you clear your mind quickly and are often asked in interviews

Practice your abstraction: A single data structure can solve many of these problems. If you choose the wrong data structure, you can’t think of anything at all. Great programmers focus more on data structures than algorithms

“Source: © Hungry Man Valley”