jackfrued / jackfrued/Python-100-Days

Day16-20选择排序bug优化

Open
#740 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
187k
Forks
55.8k
PR merge metrics
No merged PRs in 30d

Description

问题描述:
list的比较和排序是按照asc码的顺序来的,如果有一个list = ['3', '7', '10', '1', '9', '2', '111'],按照现在的算法排序结果为:result = ['1', '10', '1111', '2', '3', '7', '9']

优化:
比较部分指定类型为int或float

if comp(int(items[j]), int(items[min_index])):

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the Day16-20 selection-sort example and inspect the comparison used when finding the minimum item. Reproduce the issue with the sample list, then verify that numeric values sort in numeric order and that the example still runs correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.