frank-lam / fullstack-tutorial

🚀 fullstack tutorial 2022,后台技术栈/架构师之路/全栈开发社区,春招/秋招/校招/面试
https://frank-lam.github.io/fullstack-tutorial
11.5k stars 2.44k forks source link

插入排序有问题吧? #7

Closed liuenci closed 5 years ago

liuenci commented 5 years ago

大佬的代码会发生数组下标越界。试试我的代码 public static void sort(int[] arr) { for (int i = 0; i < arr.length - 1; i++) { for (int j = i + 1; j > 0; j--) { if (arr[j] < arr[j - 1]) swap(arr, j, j - 1); // 大量的交换会消耗时间 else { break; } } } }

frank-lam commented 5 years ago

@liuenci 谢谢你的意见。具体的位置 和 对比 能不能给一个 详细的说明,我好改进呢。当然更欢迎直接contribution。关于如何contribution,点我跳转

liuenci commented 5 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

你好,已经提交了我的 contribution,请注意查看 gayhub。

    a#ntes-pcmail-signature-default:hover {
        text-decoration: underline;
        color: #199cff;
        cursor: pointer;
    }

    a#ntes-pcmail-signature-default:active {
        text-decoration: underline;
        color: #246fce;
        cursor: pointer;
    }

在2018年9月2日 21:42,Frank<notifications@github.com> 写道: 

@liuenci 谢谢你的意见。具体的位置 和 对比 能不能给一个 详细的说明,我好改进呢。当然更欢迎直接contribution。关于如何contribution,点我跳转

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

frank-lam commented 5 years ago

@liuenci 好的,你的贡献我已经收到,明天早晨我更新下呢。近期我也再完善一下数据结构的模块,欢迎一起完善✊️

:octocat: From gitme iOS

liuenci commented 5 years ago
font{
    line-height: 1.6;
}
ul,ol{
    padding-left: 20px;
    list-style-position: inside;
}

可以的

    a#ntes-pcmail-signature-default:hover {
        text-decoration: underline;
        color: #199cff;
        cursor: pointer;
    }

    a#ntes-pcmail-signature-default:active {
        text-decoration: underline;
        color: #246fce;
        cursor: pointer;
    }

在2018年9月3日 00:12,Frank<notifications@github.com> 写道: 

@liuenci 好的,你的贡献我已经收到,明天早晨我更新下呢。近期我也再完善一下数据结构的模块,欢迎一起完善✊️ From gitme iOS

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.