自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 字符串的全排列

// .cpp : //#include "stdafx.h"#include "string.h"void fun(char* pstr, int len){ char* ptmp = new char[len+1]; printf("%s\n\n", pstr); for(int i=0;i<len; i++) { strcpy(ptmp, pstr); for(int j=i+...

2018-04-18 21:44:21 115

原创 二叉树中和为某个值得路径

// .cpp : //#include "stdafx.h"#include <queue>using namespace std;typedef struct binary_tree{ int val; binary_tree* left; binary_tree* right;}BINARY_TREE;BINARY_TREE* tree = NULL;void create_...

2018-03-23 10:46:15 136

原创 包含min函数的栈

// min.cpp : //#include "stdafx.h"#include <stack>using namespace std;class simplestack{public: stack<int> s; stack<int> mins;public: void push(int v); void pop(); int min();};void...

2018-03-15 15:14:07 108

原创 顺时针打印矩阵

// .cpp : //#include "stdafx.h"int a[4][4]={ {1,2,3,4}, {5,6,7,8}, {9,10,11,12}, {13,14,15,16}};void print(int hang, int lie){ int i = 0; int j = 0; int start_x = 0; int start_y = 0; while (i < h...

2018-03-15 10:52:34 91

原创 二叉树的镜像

// .cpp : //#include "stdafx.h"#include <queue>using namespace std;typedef struct binary_tree{ int val; binary_tree* left; binary_tree* right;}BINARY_TREE;BINARY_TREE* tree = NULL;void create_...

2018-03-14 15:05:55 124

原创 树的子结构

// .cpp : //#include "stdafx.h"#include <queue>using namespace std;typedef struct binary_tree{ int val; binary_tree* left; binary_tree* right;}BINARY_TREE;BINARY_TREE* tree = NULL;BINARY_TREE*...

2018-03-13 17:03:22 96

原创 链表倒数第k个节点

// k.cpp : //#include "stdafx.h"typedef struct _node{ int v; _node* pNext;}NODE;NODE* head = NULL;void init_list(){ NODE* pCur; int i = 0; while( i < 100) { if (head == NULL) { head = new NOD...

2018-03-01 10:19:49 120

原创 调整数组顺序使奇数位于偶数前

// jishu_before_oushu.cpp : //#include "stdafx.h"#if 0void fun(int* a, int len){ int head = 0; int tail = len - 1; for (int j = 0;j<len/2;j++) { for(int i = 0; i<len; i++) { if ( (a[i] &am...

2018-02-28 15:01:59 88

原创 二进制中1的个数

#include "stdafx.h"#include "stdlib.h"void fn(int v){ int val = v; int cnt = 0; while(val > 0) { int t = (val & 0x1); val >>= 1; if (t == 1) cnt++; } char s[33]; itoa(v, s, 2); pri...

2018-02-15 09:56:01 106

原创 剑指offer-斐波那契数列

// Fibonacci.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"int  Fibonacci(int v){if ( 0  >= v){return 0;}else if (1 == v){return 1;}else{return Fibonacci(v-1) + Fi

2018-02-05 13:50:11 113

原创 剑指offer-用两个栈实现队列

// twostackqueue.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;class myqueue{public:stack s1;stack s2;public:void push(int v);int front();void

2018-02-05 13:30:38 94

原创 剑指offer 反向打印链表

// printlistreverse.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include using namespace std;typedef struct  node{int val;node* pNext;}NODE;NODE* gpstHead = NULL;

2018-02-01 14:13:30 110

原创 剑指offer 替换空格

// 替换空格.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include "string.h"/*请实现一个函数,将一个字符串中的空格替换成“%20”。例如,当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。fun调用者保证缓冲足够大*/void fun(c

2018-01-31 13:57:35 112

原创 栈的压入弹出序列

def ispoporder(ina, outa):    if len(ina) != len(outa):        return 1;        ins = [];    j = 0;    i = 0;    for i in ina:        ins.append(i)        while  (len(ins) > 0 and in

2018-01-29 16:49:14 139

原创 最长公共子串

IF arr1[i] == arr2[j]dp[i][j] = dp[i-1]]j-1] + 1ELSEdp[i][j] = 0ENDIF#include "stdafx.h"char arrx[] = "aaaba";char arry[] = "abaa";void lcs(char* arr1, int len1, char* arr2, in

2017-11-13 22:05:41 102

原创 栈的压入弹出序列

#include "stdafx.h"#include #include using namespace std;/*j=0for  i = 0 is.push(stack_in[i])while s.top == stack_out[j] && !s.emptys.popj++endwhileendfor*/

2017-11-10 21:01:42 158

原创 最大递增子序列

动态规划: IF array[j] > array[i]dp[j] = max{dp[i]+1, dp[j]}ENDIF#include "stdafx.h"#include "string.h"int arr1[] = {35, 36, 39, 3, 15, 27, 6, 42};typedef struct  {    int val;

2017-11-10 20:04:08 95

空空如也

空空如也

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

TA关注的人

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