自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

暮日落流年的博客

记录学习生活中的一些所思、所想

  • 博客(14)
  • 收藏
  • 关注

原创 C++实现基本排序算法4:归并排序

归并排序(Merge sort)是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用,即把待排序序列分为若干个子序列,每个子序列是有序的。然后再把有序子序列合并为整体有序序列。1. 归并排序的基本原理归并排序(基于顺序容器vector_递归;基于数组array_递归_非递归)C++ Merge sort(归并排序)C+...

2019-03-27 21:41:58 1781

原创 C++实现基本排序算法3:直接选择排序

选择排序的基本思想是: 在每一趟排序中,在待排序自表中选出关键字最小或者最大的元素放在其最终的位置。本文主要介绍的是直接选择排序。1. 直接选择排序的基本原理参考文献:经典排序算法 - 选择排序Selection sort2. 代码#include <iostream>#include <vector>void Swap(std::vector&l...

2019-03-27 19:53:39 964

原创 C++实现基本排序算法2:冒泡排序和快速排序

交换排序的基本思想是:两两比较呆排列的元素,返现倒序即交换。基于这种思想的有两种排序方法,即冒泡排序和快速排序。1. 冒泡排序和快速排序的基本原理参考文章:c++实现冒泡排序冒泡排序(C/C++ 实现)算法 3:最常用的排序——快速排序白话经典算法系列之六 快速排序 快速搞定2. 参考代码#include <iostream>#include <vect...

2019-03-27 15:55:36 757

原创 C++实现基本排序算法1:插入排序和希尔排序

用C++简单的实现插入和希尔排序,也算是一个笔记吧~1. 插入排序和希尔排序的原理“深入理解”—插入排序算法白话经典算法系列之二 直接插入排序的三种实现白话经典算法系列之三 希尔排序的实现2.代码#include <iostream>#include <vector>void Swap(std::vector<int>&, in...

2019-03-27 10:21:16 371

原创 ubutu如何简单的安装XGBoost包

最近在学习xgboost, 然后安装xgboost包,然后百度一下发现安装还是挺复杂的,有的需要源码安装,然后编译,这里选择一种比较简单的方法安装。1. 安装anoconda, 然后创建一个虚拟环境这里安装anoconda的就不具体说了,然后我们设置一下镜像源,这里使用的是科大的镜像源。参考文章:1.深度学习基本环境搭建(ubutu16+Anaconda+Pycharm+Tensorf...

2019-03-10 17:00:31 419

原创 解决pip安装第三方库出现ReadTimeoutError错误

最近因为项目的需要需要重新安装一下各种包,然后竟然出现ReadTimeoutError: HTTPSConnectionPool(host=‘pypi.python.org’, port=443) with pip错误。1. 问题出现比如现在我使用命令:pip install scipy然后出现raise ReadTimeoutError(self._pool, None, 'Rea...

2019-03-05 22:07:23 3899 1

原创 LeetCode167: Two Sum II - Input array is sorted

题目链接:Two Sum II - Input array is sorted1. DescriptionGiven an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The...

2019-03-04 22:34:24 162

原创 LeetCode27: Remove Element

题目链接:Remove Element1. DescriptionGiven an array nums and a value val, remove all instances of that value in-place and return the new length.Do not allocate extra space for another array, you mu...

2019-03-04 15:47:20 150

原创 LeetCode26:Remove Duplicates from Sorted Array

开心,第一次AC一个题目这么快。题目链接: Remove Duplicates from Sorted Array1. DescriptionGiven a sorted array nums, remove the duplicates in-place such that each element appear only once and return the new lengt...

2019-03-04 14:56:06 229

原创 LeetCode18. 4Sum

2sum-&gt;3sum-&gt;4sum1. DescriptionGiven an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplet...

2019-03-03 22:15:45 139

原创 LeetCode11: Container With Most Water

Two pointer~1. DescriptionGiven n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is ...

2019-03-03 15:41:38 173

原创 LeetCode16: 3Sum Closest

和3sum类似,使用2 pointer法题目链接: 3Sum Closest1. DescriptionGiven an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of...

2019-03-03 14:53:03 194

原创 LeetCode15: 3Sum

做了2sum, 紧接着又做了3sum,发现直接套用hashmap好像有点问题~1. DescriptionGiven an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gi...

2019-03-02 20:52:32 274

原创 LeetCode1:Two Sum

1. Two Sum1.1 descriptionGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution,...

2019-03-02 11:13:15 202

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除