字符串的冒泡排序c语言,c语言单链表冒泡排序_c语言字符串排序冒泡法_c语言链表排序...

d634853e551be7d27a871481c0b2d778.png

1。 #include 2。 3。 struct Node; 4。 5。 typedef struct Node *PtrToNode; 6。 typedef PtrToNode List; 7。 typedef PtrToNode Position; 8。 typedef int ElementType; 9。 10。 struct Node 11。 { 12。 13。 14。 }; 15。 16。 List initList() 17。 { 18。 19。 20。 21。 } 22。 23。 void insertElement(List L) 24。 { 25。 26。 27。 28。 29。 30。 31。 32。 33。 } 34。 35。 void printList(List L) } int element; while(scanf("%d",&element)) { Position tmp = (Position)malloc(sizeof(struct Node)); tmp->Element = element; tmp->Next = L->Next; L->Next = tmp; List L = (List)malloc(sizeof(struct Node)); L->Next = NULL; return L; ElementType Element; Position Next;36。

1a35e1149e552ae81f3797cc681f05fc.png

{ 37。 38。 39。 40。 41。 42。 43。 44。 45。 } 46。 47。 int get_length(List L) 48。 { 49。 50。 51。 52。 53。 54。 55。 56。 57。 } 58。 59。 void BubblePoint(List L) 60。 { 61。 62。 63。 64。 65。 66。 67。 68。 69。 70。 while(i != 1) { int ic语言单链表冒泡排序,j; i = get_length(L); printf("length = %d\n"c语言单链表冒泡排序, i); Position pre; Position cur; Position next; } return i; int i = 0; Position P = L->Next; while(P != NULL) { i++; P = P->Next; } printf("NULL\n"); Position P = L->Next; printf("L->"); while(P != NULL) { printf("%d - >", P->Element); P = P->Next;71。

50af78e18659b79d5a213449406e90b3.png

72。 73。 74。 75。 76。 77。 78。 79。 80。 81。 82。 83。 84。 85。 86。 87。 88。 89。 90。 91。 92。 93。 94。 95。 96。 } 97。 }pre = L; cur = L->Next; next = cur->Next; j = i; i--; while(j != 1) { j--; if(cur->Element > next->Element) { cur->Next = next->Next; pre->Next = next; next->Next = cur;pre = next; next = cur->Next; } else { pre = cur; cur = next; next = next->Next; } }98。 int main(int argc, char **argv) 99。 { 100。 101。 102。 103。 104。 105。 List L; L = initList(L); insertElement(L); printList(L); BubblePoint(L); printList(L);106。}

本文来自电脑杂谈,转载请注明本文网址:

http://www.pc-fly.com/a/jisuanjixue/article-135575-1.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值