设顺序表L中的元素递增有序.试写一算法,将数据元素x插入到顺序表L的适当位置,以保持该表的有序性.
人气:485 ℃ 时间:2020-09-20 11:48:41
解答
struct list *p,*q,*s,*head;p = head;while(p != NULL){ if(x > p->data){q = p; p = p->next;}else{s = (struct list*)malloc(sizeof(struct list));s->data = x;q->next = s;s->next = p;}}
推荐
- 设顺序表va中的数据元素递增有序.试写一算法,将x插入到顺序表的适当位置上,以保持该表的有序性.
- 设顺序表VA中的数据元素递增有序.试写一算法.将X插到顺序表的适当位置上,以保持该表的有序性.
- 设顺序表va1的数据元素递增有序,试写一算法,将X插到顺序表的适当位置上,以保持该表的有序性
- 设顺序表L中的数据元素递增有序,试写一算法,在该表的适当位置插入新元素x并保持
- 有两个顺序表,其元素递增有序,设计一个算法,将这两个表合并到其中一个表中,并保持原表的有序性不变.
- 如果我想提高看英语新闻的能力,要一边查单词一边看吗?
- 把等腰直角三角形ABC沿斜边BC上的高线AD折成一个二面角,若此时∠BAC=60°,则此二面角的大小是_.
- 天门中断楚江开,碧水东流至此回.两岸青山相对出,孤帆一片日出来.这首诗描写什么季节,什么景色
猜你喜欢