(1)如下图所示,请根据程序补充完整未插入数据前的链表数据区域的值(依次填写)①

(2)实现链表插入的 Python 程序如下,请在程序划线处填入合适的代码。
data=[[8,-1],[7,4],[5,5],[6,0],[1,3],[2,1]] # 定义单向链表
head=2 leng=len(data)
pos=int(input("请输入要插入的位置(0~%d)之间:"%(leng)))
val=int(input("请输入要插入的数据值:"))
data.append([val,leng])
# 插入节点:
p=head
if pos==
data[leng][1]=p
head=
else:
q=data[p][1]
c=0
while c < pos-1 and q!=-1:
p=q
q=data[p][1]
c+=1
data[p][1]=leng
# 用列表形式来显示插入后的链表:
p=head
s=[ ]
while p!=-1:
s.append
p=data[p][1]
print(s)

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

