What are the advantages and disadvantages of python linked list method
This article mainly introduces the advantages and disadvantages of python linked list method, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1, advantages, easy to delete records, directly deal with the array corresponding to the subarray. The average search speed is fast. If there is a conflict, you only need to query the subarray.
2, disadvantages, the use of pointers leads to slow query speed, memory footprint may be high, not suitable for serialization.
The advantages and disadvantages of the open addressing method are opposite to those of the linked list method. Because everything in Python is based on Dict and needs to be serialized, the open addressing method is chosen.
Example
# keys function #! / usr/bin/env python# coding=utf-8 class Dict: def _ _ init__ (self, num): self.__solts__ = [] self.num = num for _ in range (num): self.__solts__.append ([]) def hash_fun (self,key) Num): hashval = 0 x = key if x < 0: print "the key is low" return while x! = 0: hashval = (hashval