pull/6/head
yuanguangxin 4 years ago
parent 6f403b5e5d
commit 4ef5993d49

@ -279,21 +279,7 @@
<workItem from="1592230200964" duration="1933000" />
<workItem from="1592291352584" duration="6590000" />
<workItem from="1592577669343" duration="2000" />
<workItem from="1592881051365" duration="204000" />
</task>
<task id="LOCAL-00024" summary="update Rocket.md">
<created>1581858072286</created>
<option name="number" value="00024" />
<option name="presentableId" value="LOCAL-00024" />
<option name="project" value="LOCAL" />
<updated>1581858072286</updated>
</task>
<task id="LOCAL-00025" summary="update Rocket.md">
<created>1581858428131</created>
<option name="number" value="00025" />
<option name="presentableId" value="LOCAL-00025" />
<option name="project" value="LOCAL" />
<updated>1581858428131</updated>
<workItem from="1592881051365" duration="423000" />
</task>
<task id="LOCAL-00026" summary="rename package">
<created>1581954761859</created>
@ -624,7 +610,21 @@
<option name="project" value="LOCAL" />
<updated>1592388297996</updated>
</task>
<option name="localTasksCounter" value="73" />
<task id="LOCAL-00073" summary="update">
<created>1592881788620</created>
<option name="number" value="00073" />
<option name="presentableId" value="LOCAL-00073" />
<option name="project" value="LOCAL" />
<updated>1592881788621</updated>
</task>
<task id="LOCAL-00074" summary="update">
<created>1592881815955</created>
<option name="number" value="00074" />
<option name="presentableId" value="LOCAL-00074" />
<option name="project" value="LOCAL" />
<updated>1592881815955</updated>
</task>
<option name="localTasksCounter" value="75" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -677,6 +677,11 @@
</entry>
</map>
</option>
<option name="OPEN_TABS">
<set>
<option value="1" />
</set>
</option>
</component>
<component name="VcsManagerConfiguration">
<MESSAGE value="add q736" />
@ -711,16 +716,16 @@
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="458" y="204" key="#com.intellij.refactoring.safeDelete.UnsafeUsagesDialog/0.0.1440.900@0.0.1440.900" timestamp="1587221348872" />
<state x="404" y="60" key="CommitChangelistDialog2" timestamp="1592881788428">
<state x="404" y="60" key="CommitChangelistDialog2" timestamp="1592881815834">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="303" y="50" key="CommitChangelistDialog2/0.0.1440.900@0.0.1440.900" timestamp="1592388297859" />
<state x="404" y="60" key="CommitChangelistDialog2/0.0.1920.1080@0.0.1920.1080" timestamp="1592881788428" />
<state x="191" y="94" width="1152" height="720" key="DiffContextDialog" timestamp="1592881784892">
<state x="404" y="60" key="CommitChangelistDialog2/0.0.1920.1080@0.0.1920.1080" timestamp="1592881815834" />
<state x="191" y="94" width="1536" height="864" key="DiffContextDialog" timestamp="1592881996931">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="143" y="78" width="1152" height="720" key="DiffContextDialog/0.0.1440.900@0.0.1440.900" timestamp="1592386883631" />
<state x="191" y="94" key="DiffContextDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1592881784892" />
<state x="191" y="94" width="1536" height="864" key="DiffContextDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1592881996931" />
<state x="143" y="78" width="1152" height="720" key="DiffContextDialog/0.23.1440.797@0.23.1440.797" timestamp="1588303139733" />
<state width="2151" height="333" key="GridCell.Tab.0.bottom" timestamp="1592301525961">
<screen x="0" y="0" width="2194" height="1194" />
@ -787,11 +792,11 @@
<screen x="0" y="0" width="1440" height="900" />
</state>
<state x="221" y="63" key="SettingsEditor/0.0.1440.900@0.0.1440.900" timestamp="1585223890241" />
<state x="427" y="228" key="Vcs.Push.Dialog.v2" timestamp="1592881789982">
<state x="427" y="228" key="Vcs.Push.Dialog.v2" timestamp="1592881816879">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="320" y="190" key="Vcs.Push.Dialog.v2/0.0.1440.900@0.0.1440.900" timestamp="1592388299499" />
<state x="427" y="228" key="Vcs.Push.Dialog.v2/0.0.1920.1080@0.0.1920.1080" timestamp="1592881789982" />
<state x="427" y="228" key="Vcs.Push.Dialog.v2/0.0.1920.1080@0.0.1920.1080" timestamp="1592881816879" />
<state x="488" y="252" key="Vcs.Push.Dialog.v2/0.0.2194.1194@0.0.2194.1194" timestamp="1591717170083" />
<state x="100" y="100" width="1240" height="700" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1587219014962">
<screen x="0" y="23" width="1440" height="797" />
@ -810,11 +815,11 @@
</state>
<state x="378" y="207" width="683" height="486" key="find.popup/0.0.1440.900@0.0.1440.900" timestamp="1586846937826" />
<state x="504" y="248" width="911" height="584" key="find.popup/0.0.1920.1080@0.0.1920.1080" timestamp="1591635370753" />
<state x="638" y="338" key="git4idea.merge.GitPullDialog" timestamp="1592881809119">
<state x="638" y="338" key="git4idea.merge.GitPullDialog" timestamp="1592881849587">
<screen x="0" y="0" width="1920" height="1080" />
</state>
<state x="479" y="282" key="git4idea.merge.GitPullDialog/0.0.1440.900@0.0.1440.900" timestamp="1592386920559" />
<state x="638" y="338" key="git4idea.merge.GitPullDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1592881809119" />
<state x="638" y="338" key="git4idea.merge.GitPullDialog/0.0.1920.1080@0.0.1920.1080" timestamp="1592881849587" />
<state x="385" y="196" width="670" height="676" key="search.everywhere.popup" timestamp="1587219643331">
<screen x="0" y="0" width="1440" height="900" />
</state>

@ -839,7 +839,50 @@ void quick_sort(int a[], int low, int high){
}
```
5. 堆排序假设序列有n个元素,先将这n建成大顶堆然后取堆顶元素与序列第n个元素交换然后调整前n-1元素使其重新成为堆然后再取堆顶元素与第n-1个元素交换再调整前n-2个元素...直至整个序列有序。
5. 堆排序将待排序序列构造成一个大顶堆此时整个序列的最大值就是堆顶的根节点。将其与末尾元素进行交换此时末尾就为最大值。然后将剩余n-1个元素重新构造成一个堆这样会得到n个元素的次小值。如此反复执行便能得到一个有序序列了。
```java
public class Test {
public void sort(int[] arr) {
for (int i = arr.length / 2 - 1; i >= 0; i--) {
adjustHeap(arr, i, arr.length);
}
for (int j = arr.length - 1; j > 0; j--) {
swap(arr, 0, j);
adjustHeap(arr, 0, j);
}
}
public void adjustHeap(int[] arr, int i, int length) {
int temp = arr[i];
for (int k = i * 2 + 1; k < length; k = k * 2 + 1) {
if (k + 1 < length && arr[k] < arr[k + 1]) {
k++;
}
if (arr[k] > temp) {
arr[i] = arr[k];
i = k;
} else {
break;
}
}
arr[i] = temp;
}
public void swap(int[] arr, int a, int b) {
int temp = arr[a];
arr[a] = arr[b];
arr[b] = temp;
}
public static void main(String[] args) {
int[] arr = {9, 8, 7, 6, 5, 4, 3, 2, 1};
new Test().sort(arr);
System.out.println(Arrays.toString(arr));
}
}
```
6. 希尔排序:先将整个待排记录序列分割成为若干子序列分别进行直接插入排序,待整个序列中的记录基本有序时再对全体记录进行一次直接插入排序。
7. 归并排序:把有序表划分成元素个数尽量相等的两半,把两半元素分别排序,两个有序表合并成一个

Loading…
Cancel
Save