码迷,mamicode.com
首页 > 其他好文 > 详细

顺序表有序插入数据

时间:2020-06-21 23:25:18      阅读:52      评论:0      收藏:0      [点我收藏+]

标签:printf   amp   struct   nod   lib   ret   lang   插入   顺序   

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
typedef struct {
    int data[8];
    int length;
}SqNode;

int FindEle(SqNode &L,int x){
    int j=0;
    for (; j < L.length; ++j) {
        if (x<L.data[j]){
            printf("%d",j);
            return j;
        }
    }
    return j;
}
int main(){

    SqNode sqNode={
            {1,2,3,4,5,6,7,8},
            8
    };

    FindEle(sqNode,3);
    return 0;
}

顺序表有序插入数据

标签:printf   amp   struct   nod   lib   ret   lang   插入   顺序   

原文地址:https://www.cnblogs.com/szj666/p/13174326.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!