Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkedList中关于size检查的部分 #10

Closed
lhsfcboy opened this issue Jul 5, 2018 · 5 comments
Closed

LinkedList中关于size检查的部分 #10

lhsfcboy opened this issue Jul 5, 2018 · 5 comments

Comments

@lhsfcboy
Copy link

lhsfcboy commented Jul 5, 2018

linked_list.py 中, class LinkedListappend 方法和 appendleft 方法中对于maxsize的检查有问题, 不是大于号而应该是大于等于号.

例如:

In [17]: l = LinkedList(4)

In [18]: l.append(0);l.append(1);l.append(2);l.append(3);

In [19]: l.append(4)

In [20]: l.append(5)
---------------------------------------------------------------------------
Exception  
@PegasusWang
Copy link
Owner

PegasusWang commented Jul 10, 2018

hi, 感谢提出。问题已经修复。mr 在: 58d5d21

@lhsfcboy
Copy link
Author

lhsfcboy commented Aug 9, 2018

应该不止那一处, 估计所有的都忘了写等号了

$ find . -name \*.py -exec grep -Hn '> self.maxsize' {} \;
./01_抽象数据类型和面向对象编程/bag_adt.py:11:        if len(self) > self.maxsize:
./03_链表/double_link_list.py:31:        if self.maxsize is not None and len(self) > self.maxsize:
./03_链表/double_link_list.py:43:        if self.maxsize is not None and len(self) > self.maxsize:
./03_链表/linked_list.py:34:        if self.maxsize is not None and len(self) > self.maxsize:
./03_链表/linked_list.py:46:        if self.maxsize is not None and len(self) > self.maxsize:
./04_队列/queue.py:35:        if self.maxsize is not None and len(self) > self.maxsize:
./05_栈/stack.py:34:        if self.maxsize is not None and len(self) > self.maxsize:
./05_栈/stack.py:46:        if self.maxsize is not None and len(self) > self.maxsize:
./double_link_list.py:32:        if self.maxsize is not None and len(self) > self.maxsize:
./double_link_list.py:44:        if self.maxsize is not None and len(self) > self.maxsize:
./linked_list.py:33:        if self.maxsize is not None and len(self) > self.maxsize:
./linked_list.py:45:        if self.maxsize is not None and len(self) > self.maxsize:

@PegasusWang
Copy link
Owner

已经更新,请 pull 下最新的 master。

@lhsfcboy
Copy link
Author

lhsfcboy commented Aug 9, 2018

好的, 谢谢~

P.S. 楼主你有没有注意到 https://github.com/PegasusWang/python_data_structures_and_algorithms/commits/master 这里面, 有些提交显示不出来头像,

我的经验是, 这通常是由于本地设置的git对应的邮箱写错了导致的, 你可以自己查查看, 否则,看到那个灰头像能逼死强迫症的.

@PegasusWang
Copy link
Owner

PegasusWang commented Aug 9, 2018

hi, 这个因为是不同电脑提交导致的。已经更新成了同一个 user,多谢提醒。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants