📄 pgm04_20.txt
字号:
## This file contains the Python code from Program 4.20 of# "Data Structures and Algorithms# with Object-Oriented Design Patterns in Python"# by Bruno R. Preiss.## Copyright (c) 2003 by Bruno R. Preiss, P.Eng. All rights reserved.## http://www.brpreiss.com/books/opus7/programs/pgm04_20.txt#class LinkedList(object): class Element(object): def insertAfter(self, item): self._next = LinkedList.Element( self._list, item, self._next) if self._list._tail is self: self._list._tail = self._next def insertBefore(self, item): tmp = LinkedList.Element(self._list, item, self) if self is self._list._head: self._list._head = tmp else: prevPtr = self._list._head while prevPtr is not None \ and prevPtr._next is not self: prevPtr = prevPtr._next prevPtr._next = tmp # ...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -