Data structure 1, overview characteristics, classification, complexity analysis

Source: Internet
Author: User

A data structure is a mathematical model that describes a non-numerical computational re-entity and how it is represented in a computer, and how these models operate in a computer


Basic concepts:

Data: A collection of all symbols that can be entered into a computer and can be processed by a computer---is the generic name of the computer's operating object



Logical organization of data structures

Linear Structure: Linear table (table, stack, queue, string, etc.)

Non-linear structure: Tree (binary tree, Huffman tree, binary index tree, etc.)

Graphs (graph, graph, etc.)

Figure "Tree" two Tree "line graph (" contains)



Storage structure of data structure

Logical structure-to-physical memory mapping

Four categories: order (the sequential address of the storage unit)

Link (the pointer's address points to the relationship)

Index (a table that indexes data, which can be used to find data efficiently)

Hash (a special index that can quickly find the stored space in the entire hash table through the mapping of the key code to be checked, and find out the data)


Abstract data types

Stack: Logical Structure: Linear table

Operating features: Restrict access to the port---allow only one end of the INSERT, delete operation

Stack ( push), Stack (POP) "most important", Top (top), stack empty (isEmpty)



Algorithm characteristics and simple classification

Problem--Algorithm--Program

Algorithm Features:

Versatility (solving the same kind of problem repeatedly) eg: eight queens problem, n post-Problem solution similar

Validity (problem solving is meaningful)

Deterministic (each algorithm step is clear)

Have poor sex (determine the time, determine the steps, can not have a dead cycle)



Basic algorithm classification

Exhaustive method: Searching for K value in order (first poor lifting)

Backtracking, search: Eight queens, graphs and tree traversal (backtracking thought: can enter into, can not enter on the change, can not change on the back)

Recursive division: To find K-value, to arrange quickly, to merge and sort by two points

Greedy method: Haffaman coding tree, shortest Dijkstra algorithm, minimum spanning tree prim algorithm

(There is greedy data structure, each greedy to find the best, finally found the structure is also the best)

Dynamic programming: The Shortest Path Floyd algorithm (the optimal solution for small-scale problems, the combination of these optimal solutions at larger scale, and finally the optimal solution to the whole large problem)








K=input () L=[1,2,3,4,5,6,7,8,9]low=0high=len (L) -1mid= (Low+high)/2def Erfen (k):    global Mid,low,high    if L[K] >l[mid]:        low=mid+1        mid= (low+high)/2        return Erfen (k)    elif L[k]<l[mid]:        high=mid-1        Mid= (Low+high)/2        return Erfen (k)    else:        print L[k],miderfen (k)




Complexity analysis of the algorithm:





Time arithmetic of large o notation

Addition rule: F1 (n) +f2 (n) =o (max (F1 (n), f2 (n)))--only cares for the longest time

Sequential structure, if structure, switch structure

Multiplication rule:F1 (N) *f2 (n) =o (F1 (n) *f2 (n))

For,while,do-while structure (nesting, looping)












Data structure 1, overview characteristics, classification, complexity analysis

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.