今天看Python CookBook中关于“求list中最大(最小)的N个元素”的内容,介绍了直接使用python的heapq模块的nlargest和nsmallest函数的解决方式,记得学习数据结构的时候有个堆排序算法,所以顺便研究了一下“堆”结构(这里特指二叉堆)。概念所谓二叉堆(binary ...
分类:
编程语言 时间:
2014-11-06 19:40:59
阅读次数:
470
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth...
分类:
其他好文 时间:
2014-11-06 19:27:14
阅读次数:
227
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an...
分类:
其他好文 时间:
2014-11-06 19:07:13
阅读次数:
205
BitsLet's denote as the number of bits set ('1' bits) in the binary representation of the non-negative integer x.You are given multiple queries consis...
分类:
编程语言 时间:
2014-11-06 14:23:23
阅读次数:
192
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-11-06 12:57:50
阅读次数:
176
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
其他好文 时间:
2014-11-06 12:33:23
阅读次数:
117
给定一个二叉树,由自底向上的层次顺序遍历返回其节点的值。...
分类:
其他好文 时间:
2014-11-06 00:44:14
阅读次数:
209
这几天A的都是二叉树的,如果输的基本操作掌握了,用递归很好解决这些题目的。这个可能不是最好的解法,明天再去Discuss看看有没有好的解法Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For t...
分类:
其他好文 时间:
2014-11-05 22:57:24
阅读次数:
261
leetcode 原题 :(即判断二叉树是否为二叉查找树)Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subt...
分类:
编程语言 时间:
2014-11-05 22:54:17
阅读次数:
204
LBP(Local Binary Pattern,局部二值模式)是一种用来描述图像局部纹理特征的算子;它具有旋转不变性和灰度不变性等显著的优点。它是首先由T. Ojala, M.Pietikäinen,和 D. Harwood 在1994年提出,用于纹理特征提取。而且,提取的特征是图像的局部的纹理特征。
从纹理分析的角度来看,图像上某个像素点的纹理特征,大多数情况下是指这个点和周围像素点的关系,即这个点和它的邻域内点的关系。从哪个角度对这种关系提取特征,就形成了不同种类的特征。有了特征,就能根据纹理进行分类...
分类:
其他好文 时间:
2014-11-05 17:17:07
阅读次数:
247