自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

一枚小小的程序猿~~~

Nothing can replace hard work

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

原创 树的广度优先遍历与深度优先遍历算法

1 树的广度优先搜索算法 广度优先搜索算法(Breadth First Search),又叫宽度优先搜索,或横向优先搜索。 是从根节点开始,沿着树的宽度遍历树的节点。如果所有节点均被访问,则算法中止。 如上图所示的二叉树,A 是第一个访问的,然后顺序是 B、C,然后再是 D、E、F、G。 那么,怎样才能来保证这个访问的顺序呢? 借助队列数据结构,由于队列是先进先出的顺序,因此可以先

2015-08-04 21:22:52 25444 2

原创 C/C++调用tensorflow编译生成的动态库,Opencv的imread读取图像为空的解决办法

问题描述添加链接描述In the meantime, as long as you’re not using any custom ops you can build libtensorflow_cc.so with bazel build --config=monolithic, which will condense everything together into one shared ...

2018-11-06 09:04:00 523

原创 源码升级cmake

参考博客: [ 源码升级cmake地址 ] 

2018-06-20 11:45:15 331

原创 Ubantu16.04, Cuda9.1安装Tensorflow

1 准备安装Ubantu16.04, Cuda9.x, Cudnn7.0.5, 具体安装方法略2 安装参考github安装Tensorflow,在mkl安装的最后有如下命令行echo 'export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib' >> ~/.bashrc需要将上面的/usr/local/li...

2018-01-24 14:22:59 622

原创 Ubuntu14.04系统安装Java 1.8

1 安装python-software-propertiessudo apt-get install python-software-propertiessudo apt-get install software-properties-common2 添加ppasudo add-apt-repository ppa:webupd8team/java3 更新系统sudo apt-get update

2017-09-26 09:20:41 1231 1

原创 ubuntu14.04 安装Matlab R2015b

ubuntu14.04 安装Matlab R2015b1 下载Matlab R2015b破解版下载地址:http://pan.baidu.com/s/1dD9F8RJ 密码: t8zi2 安装2.1 安装Matlab R2015b解压R2015b_glnxa64.iso到当前文件夹,解压后文件夹为R2015b_glnxa64。cd R2015b_glnxa64sudo ./install注意:安装

2017-08-21 14:30:26 384

原创 华为机试题:逛动物园

逛动物园Jack周日去动物园看“猩猩”,为了直达目的地,Jack想根据动物园地图计算从园区入口到“猩猩”馆的最短路径是多长?输入 5 4 0 7 3 10 15 7 0 5 13 12 3 5 0 5 10 10 13 5 0 11 15 12 10 11 0 输入中第一行第一个数为动物园展览馆总数n(包括0号馆),第二个数为“猩猩”馆的数字编号(入口编号为0号馆)。后面的输入是一个n

2015-08-31 16:47:46 1919

原创 leetcode:Shortest Palindrome

Shortest Palindrome Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can find by performing this transfo

2015-08-29 20:02:47 417

原创 leetcode:Basic Calculator II

Basic Calculator II Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer d

2015-08-26 09:39:40 574

原创 leetcode:Permutation Sequence

Permutation Sequence The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence (ie, for n = 3): “123” “132

2015-08-25 17:27:18 567

原创 leetcode:Wildcard Matching

Wildcard MatchingImplement wildcard pattern matching with support for ‘?’ and ‘*’. ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence).The matching

2015-08-22 15:53:19 640

原创 leetcode:Combination Sum

Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unl

2015-08-21 16:39:15 546

原创 leetcode:Substring with Concatenation of All Words

Substring with Concatenation of All Words You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation

2015-08-20 16:32:48 465

原创 leetcode:Reverse Nodes in k-Group

Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end

2015-08-19 17:33:05 494

原创 leetcode:Merge k Sorted Lists

Merge k Sorted Lists Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.分析 The basic idea is really simple. We can merge first two lists and then push i

2015-08-19 11:12:13 498

原创 leetcode:Binary Tree Zigzag Level Order Traversal

Binary Tree Zigzag Level Order Traversal Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the next level and alternate

2015-08-18 09:43:03 570

原创 leetcode:Binary Tree Paths

Binary Tree PathsGiven a binary tree, return all root-to-leaf paths.For example, given the following binary tree: All root-to-leaf paths are:[“1->2->5”, “1->3”]分析 深度搜索class Solution {public: v

2015-08-17 16:17:11 747

原创 正则表达式匹配

leetcode:Regular Expression Matching Implement regular expression matching with support for ‘.’ and ‘*’. ‘.’ Matches any single character. ‘*’ Matches zero or more of the preceding element. The matc

2015-08-15 11:34:25 395

原创 leetcode: Basic Calculator

leetcode: Basic CalculatorImplement a basic calculator to evaluate a simple expression string. The expression string may contain open ( and closing parentheses ), the plus + or minus sign -, non-negat

2015-08-14 19:16:01 427

原创 树的两个节点的最低公共祖先

Lowest Common Ancestor of a Binary Tree Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowest common a

2015-08-13 16:03:21 534

原创 放苹果

题目描述 把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。 输入每个用例包含二个整数M和N。0<=m<=10,1<=n<=10。<=n<=10<=m<=10样例输入 7 3样例输出 8 方法一 深度搜索,时间复杂度O(mn),空间复杂度O(1)class Solution {public:

2015-08-11 20:00:50 436

原创 Leecode:Convert Sorted Array to Binary Search Tree

描述 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 分析 二分法 代码// LeetCode, Convert Sorted Array to Binary Search Tree// 分治法,时间复杂度O(n),空间复杂度O(logn)c

2015-08-11 10:24:16 330

原创 Leetcode:Convert Sorted List to Binary Search Tree

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.// LeetCode, Convert Sorted List to Binary Search Tree// bottom-up,时间复杂度O(n),空间复杂度O(logn)

2015-08-11 10:01:50 346

原创 找出字符串中第一个只出现一次的字符

找出字符串中第一个只出现一次的字符 例如 输入:abcdab 输出:c C++代码: 时间复杂度:O(n),空间复杂度:O(1)#include<iostream>#include<vector>#include<string>#include<algorithm>#include<cctype>#include<unordered_map>using namespace st

2015-08-10 16:59:53 381

原创 查找组成一个偶数最接近的两个素数

任意一个偶数(大于2)都可以由2个素数组成,组成偶数的2个素数有很多种情况,本题目要求输出组成指定偶数的两个素数差值最小的素数对 譬如:输入20 ,输出 7 13 C++代码: 最好时间复杂度:O(n^2) ,空间复杂度:O(1) #include<iostream>#include<vector>using namespace std;class Solution {public:

2015-08-10 16:33:08 537

原创 把数组排成最小的数

输入一个正整数数组,把数组里所有数字拼接起来排成一个数,打印能拼接出的所有数字中最小的一个。例如输入数组{3,32,321},则打印出这三个数字能排成的最小数字为321323。 C++代码:class Solution {public: string minimunNumber(vector<int>& nums) { string ret; sort(n

2015-08-08 11:27:31 395

原创 leetcode:Validate Binary Search Tree

Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key. The right

2015-08-04 15:51:40 395

原创 leetcode:Number of Islands

## Number of Islands ## Given a 2d grid map of ‘1’s (land) and ‘0’s (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally

2015-08-03 16:23:23 344

原创 leetcode: 4Sum

分析: 先排序,然后左右夹逼 T(n)=O(n^3) 空间复杂的:T(n)=O(1) class Solution { public: vector<vector<int>> fourSum(vector<int>& nums, int target) { int size = nums.size(); vector<int> vec;

2015-07-31 17:36:25 356

原创 leetcode: Copy List with Random Pointer

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list./** * Definition for singly-linked lis

2015-07-31 15:48:12 369

原创 链表深拷贝

假设有如下一个链表:struct Node { int value ; struct Node *next ; struct Node *random ; } 其中,random指向该链表的任意一个节点或者NULL,请编程实现该链表的深拷贝。Node *deepCopy (Node *head)/* * 程序用来复制一个复杂链表 * 复杂链表表示

2015-07-31 10:15:13 5542 2

原创 合唱队

includeincludeincludeincludeincludeincludeinclude “math.h”using namespace std;class Solution { public: int minStudentOut(vector height){ int size =height.size(),ret=INT_MAX; vec

2015-07-30 20:45:19 322

空空如也

空空如也

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

TA关注的人

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