问答题
设计一个双向起泡排序算法,即在排序过程中交替改变扫描方向。
【参考答案】
可通过设置一个标志位进行区分的方式来进行交替扫描,算法描述如下:
Alterbubblesort(r) /*交......
(↓↓↓ 点击下方‘点击查看答案’看完整答案 ↓↓↓)
点击查看答案
<上一题
目录
下一题>
热门
试题
问答题
图的邻接表的类型定义如下所示: #define MaxVertexNum 50 typedef struct node int adjvex; struct node*next; EdgeNode; typedef struct VertexType vertex; EdgeNode*firstedge; VertexNode; typedef VertexNode A djList[MaxVertexNum]; typedef struct AdjList adjiist; int n,e;
点击查看答案
问答题
求下面算法中变量count的值:(假设n为2的乘幂,并且n>2) int Time int n count=0;x=2; while(x<n 2) x*=2;count++; return(count)
点击查看答案
相关试题
对于表A中成绩低于60的学生,如果在表B中...