您当前的位置: 首页 >  Java

xingxin666.eth

暂无认证

  • 2浏览

    0关注

    91博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

插入排序java版代码

xingxin666.eth 发布时间:2019-12-11 14:16:02 ,浏览量:2

public class Test {
    /**
     * 插入排序
     *
     * @param array
     */
    public static void insertSort(int[] array) {
        int n = array.length;
        if (n  tmp) {
                    array[j + 1] = array[j];
                } else {
                    break;
                }
            }
            array[j + 1] = tmp;
            System.out.println("第" + i + "次交换后结果," + Arrays.toString(array));
        }
    }

    public static void main(String[] args) {
        int[] array = {4, 2, 6, 1, 9, 8, 3, 5, 7};
        insertSort(array);
    }
}
关注
打赏
1663729395
查看更多评论
立即登录/注册

微信扫码登录

0.1465s