- 博客(31)
- 收藏
- 关注
转载 Decoding graph construction in Kaldi: A visual walkthrough
I've got bitten recently by an issue in a Kaldi decoding cascade I was working on. I was getting more than 40% WER, while the language and acoustic model I was using suggested the decoder should hav
2017-02-06 15:31:00 672
转载 Differences between SLF and Kaldi lattices
Differences between SLF and Kaldi latticesDuring speech recognition, the decoder explores a search space that in principle contains every possible sentence. It is often useful to save a subset of
2017-01-25 15:26:57 731
转载 Kaldi lattices format
Kaldi is based on WFST for decoding so is the lattices. Firstly, a WFST has a set of states with one distinguished start state; each state has a final cost; and there is a set of arcs between the st
2017-01-25 15:21:07 1002
转载 虚函数表
C++ 虚函数表解析 陈皓http://blog.csdn.net/haoel 前言 C++中的虚函数的作用主要是实现了多态的机制。关于多态,简而言之就是用父类型别的指针指向其子类的实例,然后通过父类的指针调用实际子类的成员函数。这种技术可以让父类的指针有“多种形态”,这是一种泛型技术。所谓泛型技术,说白了就是试图使用不变的代码来实现可变的算法。比如:模板技术,R
2016-04-18 00:58:40 197
转载 广度优先算法BFS
广度优先搜索算法(英语:Breadth-First-Search),又译作宽度优先搜索,或横向优先搜索,简称BFS,是一种图形搜索算法。简单的说,BFS是从根节点开始,沿着树的宽度遍历树的节点。如果所有节点均被访问,则算法中止。广度优先搜索的实现一般采用open-closed表。BFS是一种盲目搜寻法,目的是系统地展开并检查图中的所有节点,以找寻结果。换句话说,它并不考虑结果的可能位址
2016-04-18 00:14:22 781
转载 深度优先算法DFS
深度优先搜索算法(英语:Depth-First-Search,简称DFS)是一种用于遍历或搜索树或图的算法。沿着树的深度遍历树的节点,尽可能深的搜索树的分支。当节点v的所在边都己被探寻过,搜索将回溯到发现节点v的那条边的起始节点。这一过程一直进行到已发现从源节点可达的所有节点为止。如果还存在未被发现的节点,则选择其中一个作为源节点并重复以上过程,整个进程反复进行直到所有节点都被访问为止。属于盲目搜
2016-04-18 00:06:40 270
转载 less 逐页显示文件内容
功能:less是more的升级版,提供了更多的选项。less与more最大的不同,less 在查看之前不会加载整个文件,因此在遇上大型档案的开启时,会比一般的文书编辑器(如 vi)来的快速。less可以使用 [pageup] [pagedown] 键向前向后卷动查看文件内容。在 less 里头可以拥有更多的搜索功能。more是从UNIX系统中延续下来的(功能稍弱,这个命令是为了提供对U
2016-03-27 18:39:18 452
原创 LeetCode 110 : Balanced Binary Tree
先写一个计算深度的函数,用类似之前遍历的方式即可。判断是否为平衡树,遍历每个节点的子树是否是平衡树,如果子树都是平衡树那么它一定是平衡的。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right;
2015-09-24 16:26:40 271
原创 LeetCode 145 : Binary Tree Postorder Traversal
和先序遍历类似,根节点的操作放在最后间就可。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right
2015-09-22 15:17:15 264
原创 LeetCode 94: Binary Tree Inorder Traversal
和先序遍历类似,根节点的操作放在中间就可。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(
2015-09-22 15:11:41 281
原创 LeetCode 235: Lowest Common Ancestor of a Binary Search Tree
wiki的解释:二叉查找树,也称二叉搜索树、有序二叉树,排序二叉树,是指一棵空树或者具有下列性质的二叉树:1.若任意节点的左子树不空,则左子树上所有结点的值均小于或等于它的根结点的值;2.任意节点的右子树不空,则右子树上所有结点的值均大于它的根结点的值;3.任意节点的左、右子树也分别为二叉查找树。没有键值相等的节点。根据这种规则,可知:1.如果root的值在p和q之间,
2015-09-21 16:04:51 239
原创 LeetCode 226: Invert 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
2015-09-17 13:27:25 233
原创 LeetCode 258 : Add Digits
还是用求余和整型的除法得到每一位的数字,然后用递归去算出只有个位数的结果。class Solution {public: int addDigits(int num) { int sum=0; while(num){ sum=sum+num%10; num=num/10; }
2015-09-15 16:37:47 406
原创 LeetCode 237 : Delete Node in a Linked List
指针往后指即可/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: voi
2015-09-12 15:33:41 217
原创 LeetCode 144 : Binary Tree Preorder Traversal
先序遍历用递归去实现,先根节点再左子树,右子树。/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), rig
2015-05-14 20:33:23 284
原创 LeetCode 122: Best Time to Buy and Sell Stock II
对比vector中前后两个数,如果后者大于前者,存下差值,所有差值之和就是结果。class Solution {public: int maxProfit(vector& prices) { int size=prices.size(); int maxProfit=0; for (int i=0;i<size-1;i++ ){ if (prices.a
2015-05-11 21:16:37 264
原创 LeetCode 136 : Single Number
在一个数组中所有数都是成对出现的,除了一个数,找出这个数。普通方法,每个数都比较一遍,时间复杂度太高。简单方法,对所有数异或,最后的结果就是那个单独的数。class Solution {public: int singleNumber(vector& nums) { int a; int t; a=nums.back(); n
2015-05-07 22:16:14 270
原创 LeetCode 202 : Happy Number
如果直接写会发现一个问题,当数字不是happy number 时会陷入死循环。有个trick ,如果有重复就不是happy number , 所以需要用一个哈希表去存算过之后的数,如果重复跳出循环。这里可以用到set容器去存,find()能找出这个数的index,如果不在set中返回end()。class Solution {public: bool isHappy(int n)
2015-05-07 21:36:58 267
转载 安装第三方库出现 Python version 2.7 required, which was not found in the registry
安装第三方库出现 Python version 2.7 required, which was not found in the registry建立一个文件 register.py 内容如下. 然后执行该脚本.import sys from _winreg import * # tweak as necessaryversion = sys.versio
2015-04-15 15:21:52 331
原创 LeetCode 100: Same Tree
也是用递归的思想,判断左右子树是否一样class Solution {public: bool isSameTree(TreeNode *p, TreeNode *q) { if(!p && !q) return 1; if(!p || !q) return 0; return (p->val == q->val) && is
2015-03-31 21:20:21 346
原创 LeetCode 104: Maximum Depth of Binary Tree
方法1:递归,返回左子树或右子树加1,然后把这个值当做下次的输入。class Solution {public: int maxDepth(TreeNode *root) { if(root==NULL) return 0; else { int l=maxDepth(root->left
2015-03-31 20:54:19 274
原创 LeetCode 119: Pascal's Triangle II
循环使用上一行相邻数值相加,需要一个中间变量储存。也可以使用公式,class Solution {public: vector getRow(int rowIndex) { vector row; row.push_back(1); for (int i = 1; i <= rowIndex; ++i) { int t =
2015-03-31 20:34:29 727
原创 LeetCode 168: Excel Sheet Column Title
和171题Excel Sheet Column Number类似,反向操作即可。class Solution {public: string convertToTitle(int n) { vector a; string s; while(n) { n--; a.push_back(n%26+65);
2015-03-30 01:28:27 279
原创 LeetCode 169: Majority Element
找出两个不同的元素,成对删除,最后剩下即为所求。时间复杂度O(n)。class Solution {public: int majorityElement(vector &num) { int a=0; int count=0; for(int i=0;i<num.size();i++) {
2015-03-29 23:44:27 275
原创 LeetCode 171: Excel Sheet Column Number
example: A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28 类似于一个26进制的数进位:for(int i=0;i{ sum=sum*26+(s[i]-'A'+1);}代码:class Solution {public: int titleToNumber(string s) {
2015-03-29 22:14:32 265
原创 LeetCode 172: Factorial Trailing Zeroes
求阶乘末尾0的个数:即为找出2和5的个数。显然2的个数一定比5多,找出5的个数就行了。class Solution {public: int trailingZeroes(int n) { int a=0; while(n) { a+=n/5; n/=5; } r
2015-03-29 21:31:46 286
原创 LeetCode 9: Palindrome Number
回文数:不能用多余的空间,所以不能转成string去比较。直接对int进行操作,用除法和余数运算去翻转数字,再和原值比较。class Solution {public: bool isPalindrome(int x) { if(x<0) return 0; //if(0<x<10) return 1; //if(x=10) retur
2015-03-29 21:13:28 318
原创 LeetCode 7: Reverse Integer
把负数转成整数再inverse,注意int最大值是2147483647,要考虑到溢出的情况。class Solution {public: int reverse(int x) { int i=1; long long j=0; bool pos; if(x>=0) pos=0; else if(x
2015-03-29 21:07:24 239
原创 LeetCode 191: Number of 1 Bits
class Solution {public: int hammingWeight(uint32_t n) { int count=0;int i=1; for(i=1;i { count=count+n%2;n=n/2; }return count; }}
2015-03-29 20:59:58 227
原创 LeetCode 118 :Pascal's Triangle
class Solution {public: vector > generate(int numRows) { vector> ans; for(int i = 0;i { vector cur; if(i == 0) cur.push_ba
2015-03-29 20:44:32 421
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人