XZG_SortbyName流程图

XZG_SortbyName流程图
xuzigui 2 years ago
parent ed2925711d
commit 3d2ab7022f

@ -456,6 +456,12 @@ step 4:总分,平均分,学号,姓名依次交换
![按选择法将数组 num 的元素从低到高排序](AsScortNum.svg) ![按选择法将数组 num 的元素从低到高排序](AsScortNum.svg)
#### SortbyName #### SortbyName
step 1:利用for循环将相邻的两个姓名作比较
step 2:如果前一个字符串大于后一个利用for循环交换m门课程的成绩
step 3:依次交换
![交换法实现字符串按字典顺序排序](SortbyName.svg)
#### SearchbyNum #### SearchbyNum
Step 1:利用for循环给 i 赋值为 0 Step 1:利用for循环给 i 赋值为 0

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created by Flowgorithm 3.4.2 (http://flowgorithm.org) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.1" width="3472" height="4464">
<rect x="0" y="0" width="3472" height="4464" fill="#FFFFFF"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,248 372,323"/>
<polygon fill="#404040" stroke="none" points="372,341 389,310 354,310"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,1240 372,4198"/>
<polygon fill="#404040" stroke="none" points="372,4216 389,4185 354,4185"/>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="4" stroke-dasharray="none" d="M 217,124 A 62 62, 0, 0 0, 217 248 L 527,248 A 62 62, 0, 0 0, 527 124 Z"/>
<text x="372" y="142" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">SortbyName</tspan>
</text>
</g>
<g>
<path fill="#F0E0FF" stroke="#9070A0" stroke-width="4" stroke-dasharray="none" d="M 248,4216 A 62 62, 0, 0 0, 248 4340 L 496,4340 A 62 62, 0, 0 0, 496 4216 Z"/>
<text x="372" y="4234" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">End</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,496 372,571"/>
<polygon fill="#404040" stroke="none" points="372,589 389,558 354,558"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,744 372,819"/>
<polygon fill="#404040" stroke="none" points="372,837 389,806 354,806"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="372,992 372,1098"/>
<polygon fill="#404040" stroke="none" points="372,1116 389,1085 354,1085"/>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,341 L 186,496 L 558,496 L 558,341 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,372 558,372"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,341 217,496"/>
<text x="387" y="390" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer i</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,589 L 186,744 L 558,744 L 558,589 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,620 558,620"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,589 217,744"/>
<text x="387" y="638" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer j</tspan>
</text>
</g>
<g>
<path fill="#FFFFD0" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" d="M 186,837 L 186,992 L 558,992 L 558,837 Z"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="186,868 558,868"/>
<polyline fill="none" stroke="#A0A070" stroke-width="4" stroke-dasharray="none" points="217,837 217,992"/>
<text x="387" y="886" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="387" dy="62" unicode-bidi="embed">Integer t</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="620,1178 806,1178 806,1315"/>
<polygon fill="#404040" stroke="none" points="806,1333 823,1302 788,1302"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="806,1457 806,4092 434,4092 434,1257"/>
<polygon fill="#404040" stroke="none" points="434,1240 416,1270 451,1270"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1054,1395 1705,1395 1705,1501"/>
<polygon fill="#404040" stroke="none" points="1705,1519 1722,1488 1687,1488"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1705,3875 1705,3968 868,3968 868,1474"/>
<polygon fill="#404040" stroke="none" points="868,1457 850,1487 885,1487"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2139,1767 2356,1767 2356,2090"/>
<polygon fill="#404040" stroke="none" points="2356,2108 2373,2077 2338,2077"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3720 2356,3844 1753,3844"/>
<polygon fill="#404040" stroke="none" points="1736,3844 1766,3861 1766,3826"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="1271,1767 1023,1767 1023,3844 1656,3844"/>
<polygon fill="#404040" stroke="none" points="1674,3844 1643,3826 1643,3861"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1705,1519 L 1240,1767 L 1705,2015 L 2170,1767 Z"/>
<text x="1705" y="1692" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1705" dy="62" unicode-bidi="embed">strcmp(stu[j].name, stu[i].</tspan>
<tspan x="1705" dy="62" unicode-bidi="embed">name) &lt; 0</tspan>
</text>
</g>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,2232 2356,2679"/>
<polygon fill="#404040" stroke="none" points="2356,2697 2373,2666 2338,2666"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,2883 2356,2958"/>
<polygon fill="#404040" stroke="none" points="2356,2976 2373,2945 2338,2945"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3162 2356,3237"/>
<polygon fill="#404040" stroke="none" points="2356,3255 2373,3224 2338,3224"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2356,3441 2356,3516"/>
<polygon fill="#404040" stroke="none" points="2356,3534 2373,3503 2338,3503"/>
<g>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2604,2170 2945,2170 2945,2276"/>
<polygon fill="#404040" stroke="none" points="2945,2294 2962,2263 2927,2263"/>
<polyline fill="none" stroke="#404040" stroke-width="8" stroke-dasharray="none" points="2945,2480 2945,2573 2418,2573 2418,2249"/>
<polygon fill="#404040" stroke="none" points="2418,2232 2400,2262 2435,2262"/>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 2542,2294 L 2542,2480 L 3348,2480 L 3348,2294 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2573,2294 2573,2480"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="3317,2294 3317,2480"/>
<text x="2945" y="2312" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2945" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].score[t], &amp;</tspan>
<tspan x="2945" dy="62" unicode-bidi="embed">stu[j].score[t])</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 2170,2108 L 2108,2170 L 2170,2232 L 2542,2232 L 2604,2170 L 2542,2108 Z"/>
<text x="2356" y="2126" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">t = 0 to m-1</tspan>
</text>
</g>
<text x="2697" y="2064" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2697" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="2247" y="2250" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2247" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,2697 L 1922,2883 L 2790,2883 L 2790,2697 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,2697 1953,2883"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,2697 2759,2883"/>
<text x="2356" y="2715" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].sum, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">sum)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,2976 L 1922,3162 L 2790,3162 L 2790,2976 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,2976 1953,3162"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,2976 2759,3162"/>
<text x="2356" y="2994" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapFloat(&amp;stu[i].aver, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">aver)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1922,3255 L 1922,3441 L 2790,3441 L 2790,3255 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1953,3255 1953,3441"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2759,3255 2759,3441"/>
<text x="2356" y="3273" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapLong(&amp;stu[i].num, &amp;stu[j].</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">num)</tspan>
</text>
</g>
<g>
<path fill="#C04040" stroke="#602020" stroke-width="4" stroke-dasharray="none" d="M 1953,3534 L 1953,3720 L 2759,3720 L 2759,3534 Z"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="1984,3534 1984,3720"/>
<polyline fill="none" stroke="#602020" stroke-width="4" stroke-dasharray="none" points="2728,3534 2728,3720"/>
<text x="2356" y="3552" fill="#FFFFFF" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2356" dy="62" unicode-bidi="embed">SwapChar(stu[i].name, stu</tspan>
<tspan x="2356" dy="62" unicode-bidi="embed">[j].name)</tspan>
</text>
</g>
</g>
<g>
</g>
<ellipse cx="1705" cy="3844" rx="31" ry="31" fill="#C04040" stroke="#602020" stroke-width="4"/>
<text x="2263" y="1661" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="2263" dy="62" unicode-bidi="embed">True</tspan>
</text>
<text x="1131" y="1661" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1131" dy="62" unicode-bidi="embed">False</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 620,1333 L 558,1395 L 620,1457 L 992,1457 L 1054,1395 L 992,1333 Z"/>
<text x="806" y="1351" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="806" dy="62" unicode-bidi="embed">j = i+1 to n-1</tspan>
</text>
</g>
<text x="1147" y="1289" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="1147" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="697" y="1475" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="697" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
<g>
<path fill="#FFE0A0" stroke="#A08040" stroke-width="4" stroke-dasharray="none" d="M 186,1116 L 124,1178 L 186,1240 L 558,1240 L 620,1178 L 558,1116 Z"/>
<text x="372" y="1134" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="372" dy="62" unicode-bidi="embed">i = 0 to n-2</tspan>
</text>
</g>
<text x="713" y="1072" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="713" dy="62" unicode-bidi="embed">Next</tspan>
</text>
<text x="263" y="1258" fill="#000000" font-family="Arial" font-size="32pt" text-anchor="middle" direction="ltr">
<tspan x="263" dy="62" unicode-bidi="embed">Done</tspan>
</text>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

Loading…
Cancel
Save