[0x01 uses Python to explain data structures and algorithms] about data structures and algorithms and programming

Source: Internet
Author: User
Tags square root

Patience and perseverance are painful things, but they can gradually bring you benefits. --Ovid

I. Learning Objectives

· Review the basic knowledge in computer science, programming and problem solving process;

· Understand the important role of "abstraction" in the problem-solving process;

· Understand and implement abstract data structure;

· Review the Python programming language

Second, write in front

since the first computer used lines and switches to communicate human instructions, the way we have programmed thinking has changed a lot, and in many ways, the development of computer technology has provided many tools and platforms for computing scientists to realize their ideas. High-performance regulators, high-speed networks and large memory make it necessary for computer researchers to master the programming capabilities of such a complex spiral channel, although the computer is evolving, but some basic principles are unchanged, and computer science is concerned with using computers to solve problems. You spend a lot of time learning basic problem solving methods and expect to be confident in your ability to deal with problems, and you know the difficulty of learning some programs. The complexity of large-scale problems and the corresponding solutions greatly outweigh the underlying issues associated with the approach.

This chapter focuses on two aspects of the content. First, review the frameworks that must be followed in the study of data structures and algorithms in computer science, especially to understand why learning and understanding these topics can help us to better solve problems. Second, review the Python language. Although this is just an overview and a few short examples, this goes through the whole story.

Iii. What is computer Science (computer sciences)

computer Science is the study of problems, Problem-solving, and the solutions that come out of the the problem-solving process. Given a problem, a computer scientist ' s goal are to develop an algorithm , a step-by-step list of Instructi ONS for solving any instance of the problem, that might arise. Algorithms is finite processes that if followed would solve the problem. Algorithms is solutions.

solutions is considered independent from the machine.

algorithm , This algorithm is used to guide how to solve this kind of problem step-by-step. The algorithm is a specific processing process, follow this process can solve this problem, that is, the algorithm is solution .

Computer science, as it pertains to the problem-solving process itself, is also the study of abstraction. Abstraction allows us to view the problem and solution in such a-as to separate the so-called logical and physical per Spectives.

The study of computer science is also an abstract study, which separates the way we look at the problem from the concrete (physical), thus rising to the logical (logical) level.

As an example, when you are using the Math module in Python, when we import this module, we can do the following:

The above example is an abstraction of a process (procedural abstraction), and we don't need to know how the SQRT function is implemented, and the only thing we need to know is how to use the function. If we import the relevant modules correctly, we can assume that the result provided by this function is correct, and that it is certain that someone has implemented the function of square root, but we do not care about this problem, we usually abstract this situation into a "black box" model:

We simply describe the interface:the name of the function, what are needed (the parameters), and what'll be returned. The details are hidden inside.

We only describe the interface: the name of the function, the necessary conditions (parameters), and the return value of the function. Specific details are hidden inside.

Iv. What is programming (programming)

prog Ramming is the process of taking an algorithm and encoding it to a notation, a programming language, so That it can is executed by a computer. Although many programming languages and many different types of computers exist, the important first step is the need to H Ave the solution. Without an algorithm there can is no program.

programming is about converting algorithms to symbols (programming languages) for computer execution. Although there are many programming languages and different computers exist, the first and most important step is to find a solution to the problem, no algorithm will not have a program.

Computer science was not the study of programming. Programming, however, is an important part of what a computer scientist does. Programming is often the "the" and "we create a representation for our solutions. Therefore, this language representation and the process of creating it becomes a fundamental part of the discipline.

Computer science is not a learning program, but programming is an important work of a computational scientist. Programming is the concrete manifestation of the solution we build, so programming language is the foundation.

All data items in a computer are represented as a binary string, and in order for these binaries to make sense, we need the corresponding data type (types). The data type is our interactive interface to the binary, and the lower-level built-in data type is the basis for the algorithm development.

The difficulty, often arises for us was the fact that problems and their solutions are very complex. These simple, language-provided constructs and data types, although certainly sufficient to represent complex solutions, a Re typically at a disadvantage as we work through the problem-solving process. We need ways to control this complexity and assist with the creation of solutions.

V. Why to learn data structures and abstract data types

In order to avoid getting caught up in the details when dealing with problems, creating a data model in problem space (problem domain) can handle problems more efficiently and have more experience to focus on the problem itself.

An abstract data type, sometimes abbreviated ADT, was a logical description of how we view the data and T He operations that is allowed without regard to how they would be implemented.

Abstract data types, called ADT, are a logical abstraction of data and do not need to focus on specific implementations of his methods.

To provide this level of abstraction, we need multiple data encapsulation (encapsulation). Specifically, the specifics of the implementation of the encapsulation to ensure that the user is not visible, which is information hiding (information hiding), such as:

Python is a simple review in the next section, and if you are a beginner in python or unfamiliar with many concepts, it is recommended that you learn about Python's basic syntax and common modules, which provide some resources for learning:

Official Python Documentation: https://docs.python.org/3/reference/index.html

Python Documentation (Chinese): http://python.usyiyi.cn/

Liaoche's Python tutorial [recommended]: http://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000

stupid way to learn Python: http://download.csdn.net/detail/csulennon/8944755

Learning materials do not ask for more, a good look at a boutique series on the line, should not be a hammer of the East one hammers.

[0x01 uses Python to explain data structures and algorithms] about data structures and algorithms and programming

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.