![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
sofia嘻嘻
这个作者很懒,什么都没留下…
展开
-
LeetCodet题解--18. 4Sum(4个数的和)
链接LeetCode题目:https://leetcode.com/problems/4sumGitHub代码:https://github.com/gatieme/LeetCode/tree/master/018-4SumCSDN题解:http://blog.csdn.net/gatieme/article/details/51089460题意Given an array S o...转载 2019-03-08 22:05:02 · 101 阅读 · 0 评论 -
十大排序总结
冒泡排序(平均时间复杂度为O(n^2) ,最好情况为顺序 O(n) ,最坏为逆序O(n^2),空间复杂度为O(1)(1)改进后的冒泡排序算法:void BubbleSort2( Sqlist *L){ int i , j; Status flag = true; //用来作标记,当交换时设为true, for(i = 1; i < L->Le...原创 2019-03-19 16:28:50 · 129 阅读 · 0 评论 -
算法的几种重要查找方法
实现折半查找的两种方式//非递归 public static int binarySearch(int a[], int low, int high, int key){ int l = low, h = high, midst; while(l &lt;= h){ midst = (l + h) / 2; if(key == a[midst]){ return...原创 2019-03-18 11:30:35 · 297 阅读 · 0 评论 -
给定两个-100到100的整数x和y,对x只能加1,减1,乘2操作,问最少对x进行几次操作能得y
java解决算法:import java.util.*;public class A{ public static void main(String[] agrs){ Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int m = scan.nextIn...原创 2019-04-13 18:49:27 · 4166 阅读 · 0 评论