Comments (18)
胡歌:https://leetcode-cn.com/u/callmew/
练习内容:每日一题
累计总数:236
今日增加:1
from leetcoderank.
付有杰:https://leetcode-cn.com/u/fuyoujie2020/
练习内容:归并排序
package acwing.sort;
import java.io.IOException;
import java.util.Scanner;
/**
* @author FuYouJ
* @date 2021/12/29
* @desc
*/
public class MergeSort {
static int[] arr;
static int[] temp;
public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
arr = new int[n];
temp = new int[n];
for (int i = 0; i < n; i++) {
arr[i] = in.nextInt();
}
mergeSort(arr, 0, n - 1);
for (int i = 0; i < n; i++){
System.out.print(arr[i] + " ");
}
}
private static void mergeSort(final int[] arr) {
mergeSort(arr,0,arr.length-1);
}
private static void mergeSort(final int[] arr, int l, int r){
if (l >= r){
return;
}
int mid = l + r >> 1;
mergeSort(arr,l,mid);
mergeSort(arr,mid + 1,r);
int k = 0, i = l, j = mid + 1;
while (i<= mid && j <= r){
if (arr[i] <= arr[j]){
temp[k++] = arr[i++];
}else {
temp[k++] = arr[j++];
}
}
while (i <= mid){
temp[k++] = arr[i++];
}
while (j <= r){
temp[k++] = arr[j++];
}
k = 0;
for (int index = l; index <= r ; index++) {
arr[index] = temp[k++];
}
}
}
from leetcoderank.
zcq: https://leetcode-cn.com/u/zou-chang-qing/
练习内容:二叉树
累计总数:138
今日增加:1
from leetcoderank.
走地鸡: https://leetcode-cn.com/u/xuezhichao19970719/
练习内容:每日一题
累计总数:358
今日增加:1
直接treemap 最简单
from leetcoderank.
阿龙:https://leetcode-cn.com/u/a-long-k/
练习内容:字符串
累计总数:111
今日增加:1
from leetcoderank.
可乐:https://leetcode-cn.com/u/coke_yuemian/
练习内容:每日一题
累计总数:812
今日增加:1
from leetcoderank.
半橙汁 https://leetcode-cn.com/u/ban-cheng-zhi/
练习内容:2114. 句子中的最多单词数
累计总数:50
今日增加:1
from leetcoderank.
游子:https://leetcode-cn.com/u/myenglandgirl/
练习内容:字符串
累计总数:77
今日增加:1
from leetcoderank.
小石头:https://leetcode-cn.com/u/xingorg1/
练习内容:一手混子
累计总数:120
今日增加:1
from leetcoderank.
柏仔 https://leetcode-cn.com/u/gu-yao-c/
练习内容:验证二叉搜索树
累计总数:53
今日增加:1
from leetcoderank.
帅土豆 https://leetcode-cn.com/u/boring-karektx/
练习内容:有效的异位词
累计总数:71
今日增加:1
from leetcoderank.
来一打可爱多 https://leetcode-cn.com/u/laiyidakeaiduo/
练习内容:69. Sqrt(x)[补卡]
累计总数:54
今日增加:1
from leetcoderank.
麟 https://leetcode-cn.com/u/lin-h9/
练习内容:有效的括号
累计总数:16
今日增加:1
from leetcoderank.
小亚:https://leetcode-cn.com/u/hyl-6s/
练习内容:见2号补题
累计总数:12
增加:4
补30号-2号
from leetcoderank.
Rick:https://leetcode-cn.com/u/inspiring-sinoussi1ht/
练习内容:三数之和
累计总数:128
今日增加:1
补卡
from leetcoderank.
陈伟霆:https://leetcode-cn.com/u/will-6f/
练习内容:将一维数组转变成二维数组
累计总数:47
今日增加:1
from leetcoderank.
穷奇 https://leetcode-cn.com/u/qiong-qi-z/
练习内容:实现 strStr()
累计总数:18
今日增加:1
from leetcoderank.
shulandmimi:https://leetcode-cn.com/u/shulandmimi/
练习内容:167. 两数之和 II - 输入有序数组
累计总数:101
今日增加:1
from leetcoderank.
Related Issues (20)
- 【每日打卡】2022-03-11 第122天 HOT 2
- 【每日打卡】2022-03-12 第123天 HOT 2
- 【每日打卡】2022-03-13 第124天 HOT 1
- 【每日打卡】2022-03-14 第125天 HOT 1
- 【每日打卡】2022-03-15 第126天 HOT 2
- 【每日打卡】2022-03-16 第127天 HOT 3
- 【每日打卡】2022-03-17 第128天 HOT 4
- 【每日打卡】2022-03-18 第129天 HOT 2
- 【每日打卡】2022-03-19 第130天 HOT 2
- 【每日打卡】2022-03-20 第131天 HOT 3
- 【每日打卡】2022-03-21 第132天 HOT 2
- 【每日打卡】2022-03-22 第133天 HOT 2
- 【每日打卡】2022-03-23 第134天 HOT 1
- 【每日打卡】2022-03-24 第135天
- 【每日打卡】2022-03-25 第136天 HOT 1
- 【每日打卡】2022-03-26 第137天
- 【每日打卡】2022-03-27 第138天
- 【每日打卡】2022-03-28 第139天
- 【每日打卡】2022-03-29 第140天
- 【每日打卡】2022-03-30 第141天 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leetcoderank.