当前位置:网站首页>力扣------对奇偶下标分别排序
力扣------对奇偶下标分别排序
2022-07-29 04:55:00 【qq_37760746】

/** * Note: The returned array must be malloced, assume caller calls free(). */
int* sortEvenOdd(int* nums, int numsSize, int* returnSize){
*returnSize=numsSize;
int b;
for(int a=1;a<numsSize;a=a+2){
for(int c=a+2;c<numsSize;c=c+2){
if(nums[a]<nums[c]){
b=nums[c];
nums[c]=nums[a];
nums[a]=b;
}
}
}
for(int a=0;a<numsSize;a=a+2){
for(int c=a+2;c<numsSize;c=c+2){
if(nums[a]>nums[c]){
b=nums[c];
nums[c]=nums[a];
nums[a]=b;
}
}
}
return nums;
}
边栏推荐
- Office提示系统配置无法运行怎么办?
- Spark的算子操作列表
- C语言实现三子棋
- A little knowledge about management
- Corresponding order of 18 and 25coco data of openpose and joint points
- Take you to understand JS array
- 删除word文档中的空白页
- 央企建筑企业数字化转型核心特征是什么?
- Review key points and data sorting of information metrology in the second semester of 2022 (teacher zhaorongying of Wuhan University)
- Improve the readability of your regular expressions a hundred times
猜你喜欢

IOS interview preparation - IOS

C语言实现三子棋

命令行交互工具(最新版) inquirer 实用教程

Command line interactive tools (latest version) inquirer practical tutorial

What are the core features of the digital transformation of state-owned construction enterprises?

1 句代码,搞定 ASP.NET Core 绑定多个源到同一个类

新产品上市最全推广方案

UE plays video in scene or UMG

How to avoid damage of oscilloscope current probe

Sguard64.exe ace guard client exe: frequent disk reading and writing, game jamming, and Solutions
随机推荐
OpenCV环境搭建
2022杭电多校联赛第四场 题解
GCC Basics
新产品上市最全推广方案
Install the gym corresponding to mujoco in the spinning up tutorial, and the error mjpro150 is reported
EF core: one to one, many to many configuration
UE 在场景或UMG中播放视频
PHP判断用户是否已经登录,如果登录则显示首页,如果未登录则进入登录页面或注册页面
盒子水平垂直居中布局(总结)
搭建手机APP需要用到什么服务器
Mysql:the user specified as a definer ('root '@'%) does not exist
C语言实现三子棋
Wps如何使用智能填充快速填充数据?Wps快速填充数据的方法
Using jupyter (I), install jupyter under windows, open the browser, and modify the default opening address
Flink+iceberg environment construction and production problem handling
Academic | [latex] super detailed texlive2022+tex studio download installation configuration
软件测试面试题(四)
如何避免示波器电流探头损坏
Common current limiting methods
Nail dialog text converted to pictures cannot be copied and pasted on the document