More theoretical details can be used in the "data structure" Min to see a few times, data structure is very important to achieve a large part of the algorithm
Here's a talk about what Python implements
10.1 Stacks and queues
Stack: LIFO LIFO
Queue: FIFO first
Python uses list implementations in these features
Stack: Stack append () Rewind pop ()
Queue: Queued Append () out of the team pop (0)
Stack:
>>> stack = list ()>>> stack.append (3)>>> stack.append (2)> >> stack.append (5)>>> stack.append (1)>>> stack[3, 2, 5, 1] >>> stack.pop ()1>>> stack.pop ()5
Queue:
>>> queue = list ()>>> queue.append (1)>>> queue.append (2)> >> queue.append (3)>>> queue.append (4)>>> queue.append (5)> >> queue[1, 2, 3, 4, 5]>>> queue.pop (0)1>>> queue.pop (0)2 >>> queue[3, 4, 5]
Array implementation of linked list & pointer objects
These data structures have no value in Python and can be easily implemented with list
There is a root tree:
class Node: def __init__ (self,data): = None = None = None = Data
A node code is given, followed by a two-fork search tree Red-black tree is discussed in detail.
Hash list (hash table)
"Hash list is the generalization of the concept of ordinary arrays" one of the words to explain the hash list is better.
You can think of the array as a hash function for hash (x) = x% max (max ratio so the value is large) to get the hash value under this subscript to process the data
Pros: Very good expectations
Difficulties: Design and conflict handling of hash functions
Here's a summary of others:
Hash table (Python uses dict):
>>>#Initialize>>> a = dict (one = 1,two = 2)>>>#Access>>> a[' One']1>>>#Increase>>> a['three'] = 3>>>a{'three': 3,' One': 1,' Both': 2}>>>
Reference:
Http://www.wutianqi.com/?cat=515&paged=4
http://blog.csdn.net/fxjtoday/article/details/6448083
Introduction to algorithms tenth basic data types & 11th hash list (python)