資源簡介 1. 2022 8 Z20 31ABC ExcelD2. 2022 9 92.A.B.C.D.3. 2022 10 103.A.B.C.D. “ ”4. 2022 10 124.def travel(lnk,head):p=heads = ""while ______ ______:s += str(lnk[p][0])+"->"p = lnk[p][1]s += str(lnk[p][0])print(s)4user= [[7,2],[15,0],[5,3],[1,-1]]head = 1num = int(input(" :").strip())p=headif head==-1 or num>user[p][0]:user.append([num,head])head=len(user)-1else:while user[p][1]!=-1 and ______ ______:p=user[p][1]user.append([num,user[p][1]])______ ______travel(user,head)4A. B.lnk[p][1]!=-1 lnk[p][1]!=-11/5num<=user[p][0] num<=user[user[p][1]][0]user[p][1]=len(user)-1 user[p][1]=len(user)-1C. D.p!=-1 p!=-1num<=user[user[p][1]][0] num<=user[p][0]user[p][1]=len(user)-1 user[p][1]=len(user)5. 2022 11 125.aimport math-head=0 ; s=0p=a[head][3]while (1) :s+=math. sqrt((a[p][1]-a[head][1])**2+(a[p][2]-a[head][2])**2)(2)(3)print(s)a[head][3]!=-1 head=p p=a[head][3] head!=-1(1) (2) (3)A. B. C. D.6. 2022 11 86. 6 a6 a 6 b“ ” “ ” “ ” 6 b“ ” next “ ” next“ ” next 5“ ” next “ ” next“ ” next -1A. B. C. D.7. 2022 11 112/57.A B C D E -1A C E B D -1# a headodd = headeven = a[odd][1]tmp = evenwhile a[odd][1] != -1 and a[even][1] != -1:a[odd][1] = tmpodd = a[odd][1] even = a[even][1] a[odd][1] = a[even][1] a[even][1] =a[odd][1]A. B. C. D.8. 2022 11 108. lb[[“ ”,“13282825678”,280,1],[“”,“13256787678”,500,3],...] headphonep=headq=pwhile p!=-1:if lb[p][1]==phone:if p==head:1else:2q=p3head=lb[p][3] p=lb[p][3] lb[p][3]=lb[q][3] lb[q][3]=lb[p][3]A. B. C. D.9. 2022 11 9+1 119. Python3/5a=[[7,3],[5,0],[2,1],[9,-1]]head=2key=int(input())p=q=headwhile p!=-1 and a[p][0]q=pp=a[p][1]if p==head:a.append([key,head])head=len(a)-1else:a.append([key,p])a[q][1]=len(a)-1print(a[-1])2A. [2, -1] B. [2, 1] C. [2, 2] D. [2, 3]10. 2022 6 810. Python p a[p][0] pa[p][1] p p x x pA. a[p][1]=x;a[x][1]=a[p][1] B. a[x][1]=a[p][1];a[p][1]=xC. a[p][0]=x;a[x][0]=a[p][0] D. a[x][0]=a[p][0];a[p][0]=x11. 2022 11 1011. a[i][0] i a[i][1] ip p r rp pqa[pq][1] = a[p][1] a[r][1] = p a[p][1] = a[r][1]A. B. C. D.12. 2022 11 912.A.B. n!C.D. ( >2)13. 2022 813. Pythona=[[5,-1], [9,4], [7,3], [2, 1], [6, 0]]head=2p=head4/5b=[]while a[p][1]!=-1:b.append(a[p][0])p=a[p][1]b.append(a[p][0])print(b)程序執行后,輸出的結果為:A. [7,2,9,6,5,5] B. [5,9,7,2,6] C. [7,2,9,6,5] D. [2,9,6]14.【2022年12月強基聯盟信息技術第9題】14. 采用 Python 二維列表模擬鏈表,a=[['A', 1], ['B', 2], ['C', 3], ['D', 4], ['E', 5], ['F', -1]]表示鏈表為:A→B→C→D→E→F。有以下 Python 程序:head=0;p=a[head][1]a[head][1]=-1while p!=-1:p=a[p][1]if p == -1:breakt=a[p][1]a[p][1]=headhead=pp=t執行以上程序后,以 head 為首的鏈表結構為A. →C→A B. A→C→E C. →D→F D. F→D→B5/59. 鏈表及應用1 2 3 4 5 6 7 8B D B B A B D C9 10 11 12 13 14C B D C C A 展開更多...... 收起↑ 資源預覽 縮略圖、資源來源于二一教育資源庫