pop(i) is O(k) not O(n)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- documentation
Hướng nghiên cứu
Start with the Lists page in the FIT5211 course material and compare its pop(i) complexity statement with the Python TimeComplexity documentation linked in the issue. Update the complexity explanation and the example to cover indexed pops such as pop(-2), then verify that the displayed timing output and wording are consistent.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Error reported in course FIT5211 on page Lists by user lwoo0004 [email protected]
Incorrect info on page ... pop(i) is O(k) not O(n).
e.g. popping from an indexed location from the end of a list
See python docs:
https://wiki.python.org/moin/TimeComplexity
Pop intermediate O(k)
And revised code:
popzero = timeit.Timer("x.pop(0)", "from main import x")
popend = timeit.Timer("x.pop()", "from main import x")
popend_minus = timeit.Timer("x.pop(-2)", "from main import x") . # ADDED
print("pop(0) pop() pop(-2)")
for i in range(1000000,100000001,1000000):
x = list(range(i))
pt = popend.timeit(number=1000)
x = list(range(i))
pz = popzero.timeit(number=1000)
x = list(range(i))
pe = popend_minus.timeit(number=1000)
print("%15.5f, %15.5f, %15.5f" %(pz,pt,pe))
pop(0) pop() pop(-2)
0.40309, 0.00010, 0.00015
1.20204, 0.00009, 0.00017
1.93542, 0.00009, 0.00014
2.73203, 0.00009, 0.00014
3.45721, 0.00010, 0.00015
4.21476, 0.00011, 0.00015
5.14111, 0.00010, 0.00017
- Ngôn ngữ chính
- Python
- Star
- 274
- Fork
- 161
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của RunestoneInteractive/pythonds
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 70/100
RunestoneInteractive/pythonds#109 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
RunestoneInteractive/pythonds#126 ·
-
Incorrect number on figure 4.6Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 52/100
RunestoneInteractive/pythonds#120 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 55/100
RunestoneInteractive/pythonds#103 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 42/100
RunestoneInteractive/pythonds#99 · 5 bình luận · 1 reaction ·
Tất cả issue của RunestoneInteractive/pythonds
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
UKGovernmentBEIS/inspect_ai#5781 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Bump .cicd to wamp-cicd 4c2f9ac: `just land` refuses open A18 decisions, `just where` lists themĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
crossbario/cfxdb#139 ·
-
Bump .cicd to wamp-cicd 4c2f9ac: `just land` refuses open A18 decisions, `just where` lists themĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
crossbario/txaio#241 ·
-
UX
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
mediajunkie/piper-morgan-product#1963 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100