/structure_algorithm

structure and algorithm

Primary LanguagePythonOtherNOASSERTION

image 996.icu image

个人对数据结构和算法的学习记录和一些理解,主要是一些简单的数据结构和常用算法,

structure

线性表

+----------------+
 |  1  |  2  | 3 | 4 |
+----------------+

单链表

+---+---+     +---+---+     +---+---+     +---+---+ 
 | 1  | n  | -->| 2  | n  |--->| 3 | n |---> | 4 | n |--->
+---+---+     +---+---+     +---+---+     +---+---+

双链表

+---+---+---+             +---+---+---+              +---+---+---+          +---+---+---+        
| p   |  1  |  n |  <--->  |  p |  2  | n  |   <--->  |  p |  3 | n  |  <---> | p  |  4 |  n  |
+---+---+---+             +---+---+---+              +---+---+---+          +---+---+---+

队列

---------------------------
     ---> 4 3 2 1 --->
----------------------------

堆栈

    |   ^   |
    |   ^   |
    |   4   |
    |   3   |
    |   2   |
    |   1   |
    |        |
    |   ^   |
    |   ^   |

二叉树

                 |
                1                         1
              / | \                     /   \
            2  |   3                 3     2
          /  \ |  /  \             /   \  /   \
        4   5 |6    7          7   6 5    4   
                 |

algorithm

冒泡排序

插入排序

选择排序

快速排序

希尔排序

归并排序