What is an algorithm and what is a data structure

Source: Internet
Author: User

Although they have been studying for a few years, they can also say that they know roughly. However, as a non-computer professional, there is no more than the computer professionals know more. Since there is no special study training, naturally there will be three days of fishing two days feeling, one day may come up with an idea. So, write now the idea, there is no direct copy of the information from other places, or use their own words to make themselves understand! may be wrong, but do not be afraid, first wrong, after understanding the nature will be in the consciousness of correction.

Because the last time elective algorithm and data structure, subject to the influence of class name, although the textbook is the "Data structure tutorial", but always think that they learn the algorithm. Actually, I'm learning the data structure.

0. Introduction

Describe it in a metaphor. Books in a library are like data, and books are placed in a structure. To better manage books, you have to better place books! For example, I might put it this way:

Scenario 1:

All shelves are placed in a large room, followed by: Classics, Western Literature, Chinese literature, Nobel literature of the past years, astronomy, geography, Chinese history, foreign history, information, automation, communication, electrical and electronic ... In turn, it is assumed that the books on each bookshelf will not have the same, and that they are tied, albeit somewhat farfetched. Array

If I'm looking for a "fortress besieged", then I'll go to the first shelf to see if I have the book, and find that I don't see it again on the next bookshelf, until I find the book. (Search, linear search)

Scenario 2:

I first divided the big house into two rooms, respectively called Social Science books, natural science books. Then two rooms are divided into: history, Geography, politics, science, engineering. Divide by category in turn. (trees, various trees)

If I want to find this "data structure Tutorial", I first leisurely leisurely into the natural science Book Room, and then gently raise their heads, look at the room brand, into the engineering room ... In turn, we found the book very soon. (Tree search Logn time complexity)

This is the magic of data structures.

So what is an algorithm? This can only be forced to continue the analogy. I want to learn Kung fu. After I entered the book Room of martial Arts cheats, I ran out with a lot of books. Open a look, there is a dragon 18 palm, nine Yin Canon, nine Yang Martial, easy to warp, the universe moved, Shaolin Long claw hand, Taijiquan, drunken master, Foshan no shadow feet, seven wounds fist. I do not want to learn what martial arts, because each has a strong place, have learned time long not to kill, some crash but the damage, some need internal force, some fast and weak, some lethal but very slow. Some, though not the most powerful, are easy to learn.

Similarly, the algorithm has good or bad points: some can not guarantee convergence, and some convergence speed is slow. Some are fast but require large memory. Some, although not the local optimal solution, but simple and easy, some of the original, and some are not the original.

First, the data structure

Category

Stack:

Queue:

Linked list: Single linked list, double linked list

Various trees: AVL tree, 2-3 tree, B-tree, red-black tree, AA tree, treap tree, weighted balance tree, K-nearest neighbor tree, stretching tree, jumping table ... A variety of trees, very interesting

Hash Table: Link method, open addressing method

The main study of the following operations, the hope that less time complexity to operate:

Establish

Inquire

Insert

Delete

Second, the algorithm

Example

The various types of optimization theories:

Dynamic planning:

Integer planning:

Various non-convex algorithms: Genetic algorithm, ant colony algorithm, particle swarm algorithm, simulated annealing algorithm

...

Research objectives:

Hope that the algorithm convergence and fast, global optimization, code simple to understand, better memory, the original site, good robustness

What is an algorithm and what is a data structure

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.