Data structure and algorithm Foundation module one

Source: Internet
Author: User

In the software proficiency test, the data structure and algorithm based on the relevant content is the examination in the morning, then, the next will be on the data structure of the contents of the collation and induction, so that in the entire soft test preparation stage can be more clear and efficient learning and memory.

The following are personal to the data structure of the relevant content of the finishing, in the late according to the depth of the degree of continuous improvement and improvement, if there are any errors or deficiencies, hope can be put forward, progress together.

Common data Structures:

Array (static array, dynamic array), linear table, linked list (unidirectional linked list, doubly linked list, circular list), queue, stack, tree (balance number, binary tree, find tree, heap, clue tree), definition of graph, storage and manipulation, HASH (storage address calculation, conflict handling)

Common algorithms:

    • Sorting, finding, numerical calculation methods, string processing, primary compression algorithms, recursion, graph correlation calculation
    • The relationship between algorithm and data structure, algorithm efficiency, algorithm design, algorithm description (flowchart, pseudo-code, decision table), algorithm's complex

Then, after we clear the basic data structure and commonly used algorithms, we need to know that in the entire soft test intermediate database, this part of the score is not very large, and the requirements of the code is not very high, but must be in the whole study, we still have to understand the relationship between them, This is conducive to our later study and examination, there is a solid foundation.

Let's take a look at the test point at this stage:

1. Linear table

2. Two fork Tree

3. Figure

4. Sorting algorithms

5.Hash (hash algorithm)

6. Finding algorithms

We need to pay attention to the above points in the main study, but in these six kinds of test centers, the most need to pay attention to 1. Linear tables, 5.Hash and 6. Find the use and mastery of the algorithm. So, after we clear the relevant test center and the issues needing attention, let's take a look at the data structure.

Data structures can be divided into two main categories: logical classification:

1. Set (no logical relationship)

2. Linear structure (linear table): ① One-dimensional array ② queue ③ stack

3. Non-linear structure: ① tree ② figure ③ Multidimensional array

Classification by storage structure:

1. Sequential storage structure

2. Chained storage structure

3. Index storage structure

4. Hash storage structure

The following will be categorized according to the above study:

One, linear table (sequential table, linked list) 1. Sequential table (continuous uninterrupted) 2. Linked list (discrete separate): also divided into single linked list, circular linked list, double linked list.

Single-linked list (move in a single direction, no successor, and the last pointer field is NULL)

Circular list (similar to a single-linked list, but with a successor, the pointer field is not empty and the nodes point to the head node)

Doubly linked list (can move in two directions, with two pointer fields): Double-linked list flexibility and expense are greater than single-linked list

After the basic knowledge of the linked list, you need to understand the operation of the linked list:

1. Deletion of single-linked table nodes:

2. Insertion of single-linked table nodes

3. Deletion of doubly linked list nodes

4. Insertion of doubly linked table nodes

Note: In the case of single-linked lists and double-linked table nodes, the same way, the pointer field of the previous node points directly to the successor of the deleted node, but in the insertion operation, it is necessary to note that the pointer field of the precursor node is not directly pointing to the successor, the method is somewhat different.

The order table and the linked list have been briefly explained, then the pros and cons of the two, then the order table and the linked list to compare

Performance Category Specific projects Sequential storage Chain-Store
Space performance Storage density =1 more Excellent <1
Capacity allocation Pre-determined Dynamic change is more optimal
Time performance Find operations O (n\2) O (n\2)
Read operations O (1) better O ("n+1")/2) Best case for 1 worst case N
Insert operation

O (N/2) Best case for 0 worst case for n

O (1) better
Delete operation P ("n-1"/2) O (1) better

This table can be clearly seen in the space performance and time performance above the difference, each has its advantages, each also by the shortcomings.

Data structure and algorithm Foundation module one

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.