Advanced programmers lessons - Architect Road (1) - Introduction to Data Structures and Algorithms

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/m0_37609579/article/details/99351829

Now data structures and algorithms are also tutorials available in the market are many, but there are two problems, the first is generalities, and the second is basically c language, and java as the first mainstream language, should have its own unique. It is my intention to write these blog, I will explain the data structures and algorithms java implementation.

As for why the learning data structures and algorithms, I think we all should be clear. We usually work, knocking the business code, are all external work, can help you easily complete our bosses work, earn a monthly share of the money of their own. But I do not know little friends there is no such difficulties, the work of three to five years, the project has done a lot, but their ability to always be in the second-tier level, write business code, no point problem; want a new job interview, ask the interviewer found underlying issues are, with their usual work irrelevant. Why is there such a situation?

Because our weak economic foundation, and usually accumulated enough. Many people like this example: Programming is like a car, while internal data structures and algorithms is the auto gearbox. A drive people do not understand the principles of the gearbox is able to drive, the same way a person understand data structures and algorithms can also be programmed. However, if a motorist to understand the principles of transmission, such as reducing speed to gain more traction, or to get faster travel speed by reducing traction. Then the use of climbing a file, you can gain more traction; they use a low speed limit when the vehicle traveling downhill. Back to the terms of programming, such as the name of a class of students to be temporarily stored in memory, what would you choose to store data structures, arrays or ArrayList, or HashSet, or other data structures. If you do not understand the data structure may just choose to store a container, you can do all the functions, but with the increase later if the amount of student data, just select the data structure will certainly be a performance problem, and understand data structure and a people algorithm, the actual programming will select the appropriate data structures to resolve the issue, will greatly improve the performance of the program.

I think if you understand the data structures and algorithms, that your salary is necessarily better than do not know a friend or peer to be high, because when he was still Baidu oriented programming, you have directed at the core of the problem, you We will use the lower level more elegant way to solve the problem you are facing. This is the charm of data structures and algorithms, but also I am going to keep the content you talk.

A philosopher once said: Program = algorithm + data structure.

Data structure is a skeleton program, the algorithm is the soul of the program. Then we start from the skeleton and soul of our program journey.

A data structure

Baidu Encyclopedia: data structure is a computer store, organize data the way. Data structure refers to the presence of one or more specific mutual relationship between data elements set. Typically, the data structure may be carefully selected to bring higher operational or storage efficiency . Data structures are often associated with efficient retrieval algorithms and indexing relevant technology.

1. The basic function of the data structure

  ① How to insert a new data item

  ② how to find a particular data item

  ③ how to delete a particular data item

  ④ how to access each iteration of the data items for display or other operations

2. Data classification structure

3. With regard to advantages and disadvantages of data structures to a network of FIG.

These data structures we will describe later, make friends, do not worry.

Second, the algorithm

Baidu Encyclopedia: Algorithms (Algorithm) refers to the exact problem-solving solutions and complete description of the problem to solve a series of clear instructions , described algorithm represents a policy mechanism to solve the problem in a systematic way.

In our java, the algorithm is usually implemented by a class, in front of everyone listed in the data structure, in addition to an array (Note that the array is very special, behind speak separately), it is implemented by a class, algorithm to solve What's the problem?

Algorithm to solve is how to faster and more efficient data structures operational issues. Why do we find some data structures quickly, and some new data structure quickly deleted, this is determined by the algorithm data structure.

Features 1. Algorithm

    ① finite resistance (Finiteness)
        algorithm finite refers to the algorithm must be able to terminate after a finite number of steps performed;
    ② certainty (Definiteness)
        for each step of the algorithm must have a precise definition;
    ③ entry (Input)
        an algorithm has zero or more inputs to characterize the initial condition of operation objects, a so-called 0 refers to input the initial conditions of the algorithm itself fix;
    ④ item output (output)
        an algorithm has one or more outputs, the input data to reflect processing results after. Algorithm does not output is meaningless;
    ⑤ feasibility (Effectiveness)
        Any calculation step in the algorithm is executed can be decomposed into a basic operation of the executable step, i.e., each calculation step can be completed within a limited time ( also known as validity).

2. The principle of algorithm design

其实没那么多废话,就一条:最短时长,最短路径。

具体而言,我们设计的算法,应该是要么满足高效率,要么满足低存储。二者不可得兼。

有些时候,我们会拿时间换空间,有时又是以空间换时间。

具体应该怎么设计,要具体情况具体分析,哲人说过,没有最好的算法,只有最合适的算法。至于这个哲人是谁,还是请各位看官自己去想吧。

以上,就是我对数据结构和算法的概述,我会用大概30篇的章节给大家进行讲解,争取讲到讲透,也谢谢看官老爷们的支持。我们一起努力。


我的微信公众号:架构真经(id:gentoo666),分享Java干货,高并发编程,热门技术教程,微服务及分布式技术,架构设计,区块链技术,人工智能,大数据,Java面试题,以及前沿热门资讯等。每日更新哦!

参考文章:

  1. https://www.cnblogs.com/ysocean/p/7889153.html
  2. https://blog.csdn.net/weixin_43802541/article/details/89204221

参考书籍:参考书籍:《Java数据结构和算法》(请支持正版)

 

Guess you like

Origin www.cnblogs.com/anymk/p/11470470.html