List
Implementation Ways
1. Simple Array Implementation of List
- Insert and Delete are expensive O(N)
2. Linked List
Linked List consists of a series of structures, which are not necessarily adjacent in memory. Each structure contains the element and a pointer to a structure containing its successor. The last cell's Next pointer points to NULL.
PrintList(L) or Find(L,Key)will just traverse the list by following the Next pointers.O(N)
FindKth(L,i) takes O(i) and works by traversing down the list.
Linked List Implementation
http://blog.youkuaiyun.com/b_end_an/article/details/9395813
Stack
A stack is a list with the restriction that insertions and deletions can be performed in only one position, namely, the end of the list, called the top.
The fundamental operations on a stack are Push(insert),Pop(delete) and Top.
Implementation Ways
1. Linked List implementation+ All operations take constant time
- calls to malloc and free are expensive
2. Simple Array implementation
- We need to declare an array size ahead of time.
Linked List Implementation
http://blog.youkuaiyun.com/b_end_an/article/details/9867565
Queue
For queue, insertion is done at one end, whereas deletion is performed at the other end.
Basic operations for queue:Enqueue (insert an element at the end of the list), Dequeue(deletes/return the element at the start of the list)
Circular Array Implementation
http://blog.youkuaiyun.com/b_end_an/article/details/9938179