{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "03803ff6da3b419e8e9b650e8635444a",
  "keywords": "桶排序,算法初阶,线性时间排序,排序和顺序统计量",
  "title": "冒泡排序",
  "desc": [
    {
      "content": "\n<p>用冒泡排序编写一个函数&#xff0c;允许接受多个数字的输入&#xff0c;不使用sort方法&#xff0c;给数字从小到大排序&#xff0c;最终输出从小到大的列表。</p>",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "python"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ],
    [
      {
        "content": "",
        "language": "python"
      }
    ]
  ],
  "template": {
    "content": "#!/usr/bin/python3\ndef bubbleSort(arr):\n\tn = len(arr)\n\tfor i in range(n):\n\t\tfor j in range(0, n-i-1):\n\t\t\tif arr[j] > arr[j+1] :\n\t\t\t\tarr[j], arr[j+1] = arr[j+1], arr[j]\nx=input(\"请输入数字,空格分隔：\")\nxlist=x.split(\" \")\narr = [int(xlist[i]) for i in range(len(xlist))]\nbubbleSort(arr)\nprint (\"排序后的数组:\")\nfor i in range(len(arr)):\n\tprint (\"%d\" %arr[i]),",
    "language": "python"
  },
  "node_id": "dailycode-495106c5ee4543a98d00295b797e3982",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600469986"
}