KLYkl
|
9e914f8792
|
Update array_deque.cpp
将43行的return (i + capacity()) % capacity();改为return (i % capacity() + capacity()) % capacity();
原因:原来的表达式“(i + capacity()) % capacity();”如果i是负数的话,需要保证capacity() >= -i。而更改后的表达式“ (i % capacity() + capacity()) % capacity();” 中的先对i取模相加,最后再取模操作会确保结果是一个非负整数,并且不会超过 capacity() 的值。这是因为取模操作会返回一个在 0 到 capacity() - 1 范围内的数,即使原始的和可能是负数。保证函数index()的传入形参i<-capacity()不会崩溃,且能正确返回 0 到 capacity() - 1 范围内的的索引值。
|
2024-05-17 13:33:46 +08:00 |
|
Yudong Jin
|
a005c6ebd3
|
Some improvements (#1073)
* Update avatar's link in the landing page
* Bug fixes
* Move assets folder from overrides to docs
* Reduce figures' corner radius
* Update copyright
* Update header image
* Krahets -> krahets
* Update the landing page
|
2024-02-07 22:21:18 +08:00 |
|
Yudong Jin
|
f68bbb0d59
|
Update the book based on the revised second edition (#1014)
* Revised the book
* Update the book with the second revised edition
* Revise base on the manuscript of the first edition
|
2023-12-28 18:06:09 +08:00 |
|
krahets
|
145975b335
|
Rename the common modules in Java, C++ and C.
|
2023-04-24 04:11:18 +08:00 |
|
krahets
|
de579aa3f4
|
Fix the file headers.
|
2023-04-23 19:36:07 +08:00 |
|
krahets
|
9c9c8b7574
|
Format C++ codes in Clang-Format Style: Microsoft
|
2023-04-14 03:44:02 +08:00 |
|
Yudong Jin
|
8aebbaad21
|
refactor: Replace poll with pop in Queue and Deque (#415)
|
2023-03-13 21:58:21 +08:00 |
|
Yudong Jin
|
4f941e3d99
|
Add C++ code for the linkedlist deque and array deque (#400)
|
2023-03-02 03:00:14 +08:00 |
|