Algorithm Learning notes (i)

Source: Internet
Author: User

There are two kinds of ideas , like the jeweler on the Velvet Gem Bald , one is Calculus , the other is the algorithm. Calculus and the Mathematical analysis system established on the basis of calculus have created modern science, while algorithms have created the modern world. --"The advent of Algorithms "

Basic Data Structures


1. Linear data structure

(1) array : " string " ( e.g. data string , binary string )

(2) linked list: single linked list : data + address pointer for next element

doubly linked list : The address pointer of the previous element + data + The address pointer of the next element

Note : The difference between an array and a linked list : access is different , the array is direct single access , and the linked list is a chain-based access.

(3) Linear list :

stack: "LIFO" ( LIFO), "a stack of plates"

Insert and delete operations at end-of- stack top

queue : " FIFO", " Customer queue "

Remove Team head -and- out team

Insert -- team tail -- queue

Priority Queue : ( task ) , find or maximum element, insert a new element- - Heap


2. Figure

Graph without direction

A map of the direction

difference: whether vertex pairs (U,V) and vertex pairs (V,u) same

definition: Figure G=<v,e>

V is a finite set whose elements are vertices

E is a finite set whose elements are a pair of vertices and are edges.

Note: Do not block the ring,0<=| e|<=| v| (| V|-1)/2

depending on the number of sides : full circle, dense circle, sparse circle.

the representation of the graph :

adjacency Matrix: A boolean matrix of N*n

Adjacency list: A column with a value of 1 in the adjacency matrix

weighted circles: assigning values to edges ( weight / cost )

paths and Loops:

path: the contiguous vertex sequence starting with u ending at V

Simple path:a,c,e,f length is 3

non-simple path : a,c,e,c,f length is 4

Note: For a direction map, a forward path

Connectivity : Whether connectivity--- depends on the presence of connected components

no loop diagram: No loop included


3. Tree ( connected without circuit diagram )

Forest ( no loop but not necessarily connected, its connected component is a tree )

There is a root tree: ( application ) Describe hierarchical relationships

State space tree: Backtracking and branch boundaries

distinction / discrimination: ancestors, true ancestors, parents, children, brothers, leaf nodes, parent nodes, descendants, subtrees.

The depth of the vertex

Height of the tree

4. Ordered Tree

Binary tree, binary search tree, multi-path lookup tree.

Note: first child after brother notation


5. Collections and dictionaries

a method that represents a collection: a bit vector, Linear list Structure

Abstract data type: A collection of abstract objects for data items and a series of operations on those objects

Collection Merge Issues


This article is from the "book Notes" blog, please be sure to keep this source http://xiexiao.blog.51cto.com/10173801/1652142

Algorithm Learning notes (i)

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.