提高篇26-27课第一题
来源:互联网 发布:安卓软件开发教程 编辑:程序博客网 时间:2024/06/01 15:58
#include<stdio.h>#include<stdlib.h>#define N 10int insert(int array[], int len, int num);int main(){int a[N] = { 1, 7, 8, 17, 23, 24, 59, 62, 101 };int i, n = 9;int m = 50;n = insert(a, n, m); //在长度为n的a数组中插入m,使仍保持有序for (i = 0; i<n; ++i)printf("%d ", a[i]);printf("\n");return 0;}int insert(int array[], int len, int num){int i,j;for (i = 0; i < len; i++)if (num<=array[i]){for (j = len; j > i; j--)array[j] = array[j - 1];array[i] = num;return len + 1;//插入已经结束,提前返回}array[len] = num;//插入的数据比所有的数据都大,放在最后return len + 1;}
0 0
- 提高篇26-27课第一题
- 提高篇第2-5课第一题
- 提高篇第6-10课作业第一题
- 提高篇第20-21课作业第一题
- 提高篇第22-25课作业第一题
- 提高篇第28-31课第一题
- 提高篇26-27课第四题
- 提高篇第26-27课第二题
- 提高篇第26-27课第三题
- 脱壳基础知识入门和提高-----第一课 PE格式
- noip提高组day1 第一题 转圈游戏
- NOIP2005 提高组第一题 谁拿了最多奖学金
- 提高篇第一讲项目5-当年第几天
- 提高篇2-5课第五题
- NOIP 提高组第一式第一题——玩具迷题
- 模拟(玩具谜题NOIP 2016 提高组 Day 1 第一题vijos2003)
- 动态规划之——拦截导弹 NOIP1999(提高组) 第一题
- 2012年分区联赛提高组第一天第一题…
- 第十四章 SSL——《跟我学Shiro》
- ActiveMQ之spring集成消息转换器MessageConverter
- PL/SQL错误提示 database character set(AL32UTF8) and Client character set(ZHS16GBK) are different
- Adaboost算法的可视化训练过程
- SQL从一个库把数据导到另外一个库
- 提高篇26-27课第一题
- PHP防御防御永久型和反射XSS
- 第十五章 单点登录——《跟我学Shiro》
- C# 基础学习第二天
- arcEngine 求点到polyline集合的最近点 包括垂足计算
- ActiveMQ之集群介绍
- C语言条件编译及编译预处理阶段
- FMDB详解
- 第十六章 综合实例——《跟我学Shiro》