依次输入34,67,12,44,23,8,81,77,建立的二叉搜索树是()
A.
B.
C.
D.
- · 有4位网友选择 D,占比44.44%
- · 有4位网友选择 C,占比44.44%
- · 有1位网友选择 A,占比11.11%
A.
B.
C.
D.
A、
B、
C、
D、
A、import queue as que import math x=[] y=[] def koch(ax,ay,bx,by,c): dist=(bx-ax)*(bx-ax)+(by-ay)*(by-ay) if(dist<=c): x.append(ax) x.append(bx) y.append(ay) y.append(by) else: cx="ax+(bx-ax)/3" cy="ay+(by-ay)/3" ex="bx-(bx-ax)/3" ey="by-(by-ay)/3" l="math.sqrt(math.pow(ex-cx,2)+pow(ey-cy,2))" alpha="math.atan((ey-cy)/(ex-cx))" if (alpha>=0 and (ex-cx)<0) or and alpha="alpha+math.pi" dy="cy+math.sin(alpha+math.pi/3)*l" dx="cx+math.cos(alpha+math.pi/3)*l" koch(ax,ay,bx,by,c) koch(bx,by,cx,cy,c) koch(cx,cy,dx,dy,c)> B、import queue as que import math x=[] y=[] def koch(ax,ay,bx,by,c): dist=(bx-ax)*(bx-ax)+(by-ay)*(by-ay) if(dist<=c*c): x.append(ax) x.append(bx) y.append(ay) y.append(by) else: cx="ax+(bx-ax)/3" cy="ay+(by-ay)/3" ex="bx-(bx-ax)/3" ey="by-(by-ay)/3" l="math.sqrt(d/3)" alpha="math.atan((ey-cy)/(ex-cx))" if (alpha>=0 and (ex-cx)<0) or and alpha="alpha+math.pi" dy="cy+math.sin(alpha+math.pi/3)*l" dx="cx+math.cos(alpha+math.pi/3)*l" koch(ax,ay,cx,cy,c) koch(cx,cy,dx,dy,c) koch(cx,cy,ex,ey,c)> C、import queue as que import math import matplotlib.pyplot as plt x=[] y=[] def koch(ax,ay,bx,by,c): dist=(bx-ax)*(bx-ax)+(by-ay)*(by-ay) if(dist<=c*c): x.append(ax) x.append(bx) y.append(ay) y.append(by) else: cx="ax+(bx-ax)/3" cy="ay+(by-ay)/3" ex="bx-(bx-ax)/3" ey="by-(by-ay)/3" l="math.sqrt(math.pow(ex-cx,2)+pow(ey-cy,2))" alpha="math.atan((ey-cy)/(ex-cx))" if (alpha>=0 and (ex-cx)<0) or and alpha="alpha+math.pi" dy="cy+math.sin(alpha+math.pi/3)*l" dx="cx+math.cos(alpha+math.pi/3)*l" koch(ax,ay,cx,cy,c) koch(cx,cy,dx,dy,c) koch(dx,dy,ex,ey,c)> D、import queue as que import math x=[] y=[] def koch(ax,ay,bx,by,c): dist=(bx-ax)*(bx-ax)+(by-ay)*(by-ay) if(dist<=c*c): x.append(ax) x.append(bx) y.append(ay) y.append(by) else: cx="ax+(bx-ax)/3" cy="ay+(by-ay)/3" ex="bx-(bx-ax)/3" ey="by-(by-ay)/3" l="math.sqrt(d/3)" alpha="math.atan((ey-cy)/(ex-cx))" if (alpha>=0 and (ex-cx)<0) or and alpha="alpha+math.pi" dy="cy+math.sin(alpha+math.pi/3)*l" dx="cx+math.cos(alpha+math.pi/3)*l" koch(ax,ay,cx,cy,c) koch(ex,ey,dx,dy,c) koch(cx,cy,ex,ey,c)>
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!