data structure

https://www.learn-c.org/en/Linked_lists  

https://www.youtube.com/watch?v=VOpjAHCee7c

 

  • Linked List, include the data, and a pointer which point to the next node. 

e.g typedef struct person 

{str  name

person *

}   

Pro: Easy for add and delete, Con: Search is taking time. 

 

 

  • Arrary 

Pro: Search is easy, Con: runing out of memoery due to adding now item, in Java or python it is ok as it not need to declear the size, but in C you do need to do so,

 

  • Hash Table 

In python, it is implmend as dictionary.  Hash function can saved the value for a key to a specific location, 

Pro: Add , remove, retrieving is easy 

Con : Two key can saved in same location which is called data collision.   it need to use Separate Chaining or Open Addressing.

Last in , frist out, push, pop 

Queue, first in first out, enqueu, deeuque 

limited use. 

  • Graphs and trees

 

posted @ 2020-05-24 05:04  anyu686  阅读(156)  评论(0编辑  收藏  举报