Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the advantages and disadvantages of python linked list method

Shulou Source: shulou.com Published: 2022-06-03 17:41:31 11月13日 Update

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

Tags: Articles advantages and disadvantages arrays functions sequences openness speed openness query subscript value advantages interests memory at the same time examples pointers more friends knowledge Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Linux MySQL Huawei Shulou Tech Info