当前位置:网站首页>力扣------对奇偶下标分别排序
力扣------对奇偶下标分别排序
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;
}
边栏推荐
- 钉钉对话框文子转换成图片 不能复制粘贴到文档上
- How to set row height and column width in excel? The method of setting row height and column width in Excel
- IOS interview preparation - other articles
- RecyclerView通过DPAD按键上下切换焦点 切换到界面外的控件时焦点会左右乱跳
- 使用更灵活、更方便的罗氏线圈
- 虚拟偶像的歌声原来是这样生成的!
- Double type nullpointexception in Flink flow calculation
- Reveal安装配置调试
- Google browser opens the web page and out of memory appears
- Leetcode 763. partition labels divide alphabetic intervals (medium)
猜你喜欢
【无标题】
(heap sort) heap sort is super detailed, I don't believe you can't (C language code implementation)
网络之以太网
The most complete NLP Chinese and English stop words list in the whole station (including punctuation marks, which can be copied directly)
iOS面试准备 - ios篇
Learn matlab to draw geographical map, line scatter bubble density map
荣耀2023内推,内推码ambubk
Reveal installation configuration debugging
Stack and queue and priority queue (large heap and small heap) simulation implementation and explanation of imitation function
spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法
随机推荐
GCC Basics
Classes and objects (II)
五个关联分析,领略数据分析师一大重要必会处理技能
Delete blank pages in word documents
pulsar起client客户端时(client,producer,consumer)各个配置
Google browser opens the web page and out of memory appears
Deadlock to be resolved
MySQL regularly calls preset functions to complete data update
Climbing the pit of traffic flow prediction (II): the simplest LSTM predicts traffic flow using tensorflow2
钉钉对话框文子转换成图片 不能复制粘贴到文档上
使用更灵活、更方便的罗氏线圈
Data Lake: spark, a distributed open source processing engine
数据湖:分布式开源处理引擎Spark
spinning up安装完使用教程测试是否成功,出现Library“GLU“ not found和‘from pyglet.gl import *错误解决办法
如何安装office2010安装包?office2010安装包安装到电脑上的方法
Makefile+Make基础知识
ssm整合增删改查
Mujoco and mujoco_ Install libxcursor.so 1:NO such dictionary
ios面试准备 - objective-c篇
IOS interview preparation - Online