What about the data agency?

Source: Internet
Author: User

Why do we have to learn about data structures? Learn what the linked list, insert delete data, look at the code, feel very complex. What is this for? C or C + + can not be inserted into the data, storage data? Building the number of groups, the use of pointers can be very convenient? It's going to cost the unwinnable to write a bunch of code to save two data for a linked list?

Answer one:

The advantage of a linked list is that instead of using contiguous memory, the data is stored in an in-memory storage unit, and the length of the list can be arbitrarily added and deleted, but once an array is applied it cannot be changed, which simply does not satisfy the dynamic storage of the data, and the deletion and insertion of the array will move the large amount of data. This increases the computational capacity;

Data structure of the idea is still very good, not to mention a variety of sorting and graph, Binary tree algorithm design, a single stack is very esoteric, he can be some complex and difficult to understand the recursive algorithm, disassembly rewrite, let you on these algorithms at a glance.

Answer two:

Data structure is a kind of thought tool, like we drink water with a cup, eat with chopsticks, here the cup and chopsticks is the data structure, if we do not have this idea, then we can only get down to drink the river, with hands to grab something to eat.

For example, if we are going to make a hammer (the kind of metalworking practice), what do we need, with only two pieces of iron? No, we have to have lathes and tools like sandpaper. So we have to make a hammer, we must have a certain tool. Now there is another problem, can we use tools? Yes, but you'll waste a lot of time and energy. Data structure is invented for the purpose of making tools, with tools, solve the problem is much easier.

Answer three:

The program is not used to play, or most of the useful programs are used to process data, you do a MP3 player, how do you give MP3 decoding? You need to put the music code in memory, then decode it, how is the data stored in memory? This is the data structure.

For the list, if you need to process data at high speed, such as a MP3 player, you want to delete some of the wrong music code, and the code is randomly arranged in the data, if used in the array: 1 in the address of the useless code (memory not freed) 2 to delete the array of these members, Rearranging the array and using the linked list is simple. Change the pointer, ok!

What about the data agency?

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.