对于n个元素的关键宇序列{k1,k2,...kn},当且仅当满足关系ki≤k2i

资格题库2022-08-02  50

问题 对于n个元素的关键宇序列{k1,k2,...kn},当且仅当满足关系ki≤k2i且ki≤k2i+1{i=1.2...[n/2]}时称其为小根堆(小顶堆)。以下序列中,(60)不是小根堆。A.16,25,40,55,30,50,45B.16,40,25,50,45,30,55C.16,25,39.,41,45,43,50D.16,40,25,53,39,55,45

选项 A.16,25,40,55,30,50,45
B.16,40,25,50,45,30,55
C.16,25,39.,41,45,43,50
D.16,40,25,53,39,55,45

答案 D

解析 按照条件“ki≤k2i且ki≤k2i+1”要求,带入四个选项。以选项A为例,当i=时,K1(16)<K2(25),且K1(16)<K3(40)...依次类推,可得选项D不满足要求。
转载请注明原文地址:https://tihaiku.com/congyezige/2407804.html

最新回复(0)