自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 bjut算法作业 压缩与解压

// 作业3.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <windows.h>#include <fstream>#include <vector>#include <algorithm>#include <cstrin..

2018-04-27 13:17:50 298 1

原创 Leetcode 108. Convert Sorted Array to Binary Search Tree

解法:永远以中点为根,左右划分,之后递归。将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1。示例:给定有序数组: [-10,-3,0,5,9],一个可能的答案是:[0,-3,9,-10,null,5],它可以表示下面这个高度平衡二叉搜索树: 0 / \ -3 ...

2018-04-26 16:51:57 134

原创 Leetcode 107. Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree [3,9,20,null,null,15,7], ...

2018-04-26 15:48:44 114

原创 Leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { //和上一...

2018-04-25 19:18:03 180

原创 bjut第二届算法

F:上课上课上课查看提交统计提问总时间限制: 1000ms内存限制: 256000kB描述ACSync 是个上课狂,大学期间曾立志要上完大学里所有的课,假设所有课都是年年开并且上课时间不变,聪明的你快来帮帮他算一下他的鸿鹄之志能否终成正果?输入​第一行为 2 个数 N, M,分别表示课程的总数和 ACSync 可以上课的总年数;接下来的 N 行,第 i 行为两个整数 Ai, Bi (Ai <...

2018-04-25 17:09:46 243

原创 Leetcode 105. Construct Binary Tree from Preorder and Inorder Traversal

/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */class Solution { publ...

2018-04-25 16:56:37 111

原创 Leetcode 101. Symmetric Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas...

2018-04-25 15:18:30 172

原创 Leetcode 105. Construct Binary Tree from Preorder and Inorder Traversal

解法:1.先序中第一个是根 2.中序根据顶点分左右两枝 3.先序先访问顶点 中序先访问左字数 

2018-04-20 16:48:49 112

原创 Leetcode 103. Binary Tree Zigzag Level Order Traversal

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */cla...

2018-04-20 16:23:55 96

原创 Leetcode 102. Binary Tree Level Order Traversal

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas...

2018-04-20 15:22:38 115

原创 SQLyog图形化l数据库的操作和学习

https://www.cnblogs.com/biehongli/p/6032905.html?utm_source=itdadao&utm_medium=referral

2018-04-18 15:30:48 568

原创 Leetcode 104. Maximum Depth of Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */clas...

2018-04-18 11:05:04 118

原创 Leetcode 91. Decode Ways

class Solution {public: //动态规划 连着两个能变成新的加1 反之等于dp[i-1] bool judge(string s) { int gewei,shiwei,ans; gewei = s[1] - '0'; shiwei = s[0] - '0'; ans = gewei + 10 * shiwei; return (ans > ...

2018-04-12 14:03:49 125

原创 Leetcode 97. Interleaving String

/*//分治法:如果首字母相同 就递归剩下的字符串 程序显而易见 但递归必然超时 所以用动态规划class Solution {public: bool isInterleave(string s1, string s2, string s3) { // Start typing your C/C++ solution below // DO NOT write int mai...

2018-04-08 14:28:53 114

原创 leetcode 72. Edit Distance

题解参考http://www.cnblogs.com/grandyang/p/4344107.html72. Edit DistanceDescriptionHintsSubmissionsDiscussSolutionPick OneGiven two words word1 and word2, find the minimum number of steps required to conv...

2018-04-07 23:41:49 140

原创 北工大算法 作业2 动态规划 01背包问题

可以参考下面的文章 思路写的比较清晰https://blog.csdn.net/u010293698/article/details/48979623https://blog.csdn.net/sinat_22991367/article/details/51861373给定n种物品和一个背包,物品i的重量是wi,其价值为vi,背包的容量为C。背包问题是如何选择装入背包的物品,使得装入背包中物品的...

2018-04-03 16:20:02 467

原创 动态规划入门 数字三角形(POJ1163)

数字三角形(POJ1163)输入格式:5      //表示三角形的行数    接下来输入三角形73   88   1   02   7   4   44   5   2   6   5要求输出最大和与递归类似,分解成若干字问题,但相互直接有联系,每一层的最大值由下面那层而来。#include "stdafx.h"#include <iostream> #include &l...

2018-04-03 12:08:09 214

原创 Leetcode 100. Same Tree

Given two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:In...

2018-04-02 13:26:35 109

原创 邮局问题 快速排序 分治

// 邮局选址问题.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include <iostream>#include <algorithm>#include <string>#include <vector>#include <fstream>#include <memory..

2018-04-02 10:58:00 1153

空空如也

空空如也

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

TA关注的人

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