自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 [Sort]归并排序

#include<iostream>using namespace std;/*合并有序数组,first-mid和mid-last。num为两个数组的总长度*/void Merge_Array(int a[],int first,int mid,int last){ int num = last - first +1; int* temp = new int[num];

2015-11-29 21:03:36 314

原创 [Sort]希尔排序

详细介绍,在本博客的数据结构栏目里有,不过是java版#include<iostream>using namespace std;void Shell_Sort(int a[],int num){ int d,i,j,c; for(d = num/2;d>0;d/=2) { for(i = d;i<num;i++) {

2015-11-29 20:19:56 309

原创 [Sort]基数排序-两种实现

1、LSD-最低位优先//获取数据中最大的位数(1)a[]为存储数据的数组。(2)为数组的个数int maxbit(int a[],int num){ int d =1; int p =10; for(int i=0;i<num;i++) { while(a[i] >= p) { p*=10;

2015-11-29 19:11:46 449

原创 [Sort]堆排序

#include<iostream>using namespace std;//调整堆函数,需要三个参数,(1)存储数据的数组。(2)某个父节点。(3)num,数组的长度void Heap_Adjust(int a[],int p,int num){ int left_node = 2*p +1; //数组起始元素为0,所以2*p+1开始 int right_node = 2*p

2015-11-29 14:21:54 242

原创 [Sort]冒泡排序

#include<iostream>using namespace std;void Bubble_Sort(int a[],int num){ for(int i = num;i > 1;i--) { for(int j=0;j<i -1;j++) { if(a[j] > a[j+1]) {

2015-11-29 11:15:26 325

原创 [Sort]选择排序

#include<iostream>using namespace std;void Select_Sort(int a[],int num){ for(int i=0;i<num-1;i++) { int x = i; //要选择的点的位置 for(int j = i+1;j<num;j++) { if(a[

2015-11-29 10:11:30 326

原创 [Sort]插入排序-两种实现

1、直接插入排序:void insert_sort(int a[],int num){ for(int i=1;i<num;i++) { int m = a[i]; int j = i; while(a[j-1] > m && j > 0) { a[j] = a[j-1];

2015-11-28 23:16:31 343

原创 [Sort]快速排序-递归实现

#include<iostream>using namespace std;void QuickSort(int a[],int low,int high){ if(low < high) { int pivot = a[low]; //基准 int first = low; int last = high; whil

2015-11-28 23:14:18 378

原创 [LeetCode]002-AddTwoNumber

Problem:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as

2015-11-28 19:55:42 382

原创 [LeetCode]001-TwoSum

Problem:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target,

2015-11-28 10:13:07 331

空空如也

空空如也

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

TA关注的人

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