自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

西电流浪者的博客

自学找工作

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

原创 排序之合并排序

#include<stdio.h> #include<stdlib.h> #include<malloc.h> #include<time.h> #include<iostream> using namespace std; // void PrintArr(int *pnArr, int nlen) { for (int i = 0;...

2018-07-12 16:36:56 228

原创 查找链表的中间节点的两种方法

struct ListNode { int val; ListNode *next; ListNode(int x) : val(x), next(nullptr) {} }; class Solution { public: ListNode* GetMiddele(ListNode *head) { if (head == nullptr) return false; ...

2018-07-10 15:39:49 4173

原创 leetcode 链表的插入排序

/*** Definition for singly-linked list.*/ struct ListNode {     int val;     ListNode *next;     ListNode(int x) : val(x), next(nullptr) {} };class Solution {public: ListNode *insertionSortList(ListNo...

2018-07-10 14:25:41 199

原创 leetcode之重排序链表

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; /* 一: 要找到链表的中间节点,然后把链表分为两个, 最关键的是不要忘记找到中间节点...

2018-07-10 11:01:10 287

翻译 数据结构排序之归并排序

/* *递归 归并排序 */ #include<iostream> using namespace std; void Merge(int *, int , int, int *); void Merge_Sort(int *data, const int start, const int end, int * result ) { if( 1 == end - start)//...

2018-06-20 21:35:10 213

翻译 不使用库函数将整数转换为字符串

把整数的各位数字加‘0’转换成char类型,并存到字符数组中,程序如下,可在Visual studi0 2010 下运行#include<iostream> using namespace std; void int2str(int n, char * str) { char buf[10] = ""; int i = 0; int len = 0; int...

2018-06-06 11:11:02 519

原创 数据结构排序算法之快速排序

快速排序#include<iostream> using namespace std; void swap(int arr[], int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } void QuickSort(int arr[], int left, int right) { //取一...

2018-05-30 15:55:07 247

原创 排序算法之选择排序和冒泡排序

选择排序在排序数组中选择一个最大或者最小的元素放到首位,然后在对除去首位的元素进行选择排序、冒泡排序的工作原理是比较相邻的两个元素,然后把最小或者最大的元素依次交换位置(交换的次数多),而选择排序的工作原理是把找出最小或者最大元素的索引,然后只交换首元素和该索引的值即可。选择排序 void XuanzeSort(int *arr[], int length) { int k = 0; ...

2018-05-30 10:59:05 183

原创 数据结构排序算法之希尔排序

点击打开链接ShellSort(int *arr[], int length) { int gap = length/2; while(gap) { for(int i = gap; i++; i<length) { int InsertNumber = arr[i]; i...

2018-05-28 12:56:48 233

翻译 插入排序之直接插入排序

直接插入排序是简单排序,把待排序的数组看成是两个数组,一个是已经排好序的数组,一个待排序的数组下面的程序是从后往前InsertSort(int *arr[], int length) { for(int i = 1; i < length; i++) { int InsertNumber = arr[i]; int j = i; ...

2018-05-28 11:17:13 194

原创 Effective c++条款17 以独立语句将newed 对象置入智能指针

对象管理资源,new出来的是一个指针,需要放到智能指针当中 shared_ptr(类型) pw1:智能指针是一个类,它有自己的构造函数和析构函数,而不是一个指针2:智能指针的构造函数是显示构造函数,不能够进行隐式转换条款17的意思就是 new 对象放到智能指针中要用单独的语句std::str1::shared_ptr<widget>pw(new Widget)如果不用单独的语句proc...

2018-05-27 19:48:53 208

空空如也

空空如也

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

TA关注的人

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