{
  "type": "code_options",
  "author": "csdn.net",
  "source": "solution.md",
  "exercise_id": "f03f64b19771450cbd73e10f1d38a4b1",
  "keywords": "图算法,算法高阶,最小生成树,最小生成树的形成",
  "title": "用0到9生成十位数的所有排列组合",
  "desc": [
    {
      "content": "\n用 0到9  生成 十位数的所有排列组合，数字0不能在第一个，这个生成的十位数，不能有重复的数字。",
      "language": "markdown"
    }
  ],
  "answer": [
    {
      "content": "",
      "language": "java"
    }
  ],
  "prepared": [
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ],
    [
      {
        "content": "",
        "language": "java"
      }
    ]
  ],
  "template": {
    "content": "class java_234859 {\n   public static void main(String[] args) {\n\t  String str[] = { \"0\", \"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\" };\n\t  permutation(str, 0, str.length);\n   }\n   static void swap(String[] str, int start, int end) {\n\t  String tmep = str[start];\n\t  str[start] = str[end];\n\t  str[end] = tmep;\n   }\n   static void permutation(String[] str, int start, int end) {\n\t  if (start == end - 1) {\n\t\t for (int i = 0; i < end; i++) {\n\t\t\tSystem.out.print(str[i]);\n\t\t }\n\t\t System.out.println();\n\t  } else {\n\t\t for (int i = start; i < end; i++) {\n\t\t\tif (i == 0 && str[0].equals(\"0\"))\n\t\t\t   continue;\n\t\t\tswap(str, start, i);\n\t\t\tpermutation(str, start + 1, end);\n\t\t\tswap(str, start, i);\n\t\t }\n\t  }\n   }\n}",
    "language": "java"
  },
  "node_id": "dailycode-91a33b05aa5342848cafc5816a49e0d4",
  "license": "csdn.net",
  "created_at": 1637894161,
  "topic_link": "https://bbs.csdn.net/topics/600470287"
}