码迷,mamicode.com
首页 >  
搜索关键字:算法    ( 83296个结果
学习软件工程课的心得
一开始看到软件工程的课本的时候,我看了一下,书名为《软件工程——理论、方法与实践》,我本来以为这将会是大三这一学期相对轻松的课程。 没有想到,第一节课,老师的PPT上对软件工程课的吐槽让我惊呆了,我想,到底该怎么办啊?是不是这一学期会被这门课给烦死给累死啊。然后不出所料的,不久之后老师就布置了第一....
分类:其他好文   时间:2014-06-02 12:43:58    阅读次数:163
MTF(Move-to-front transform)数据转换
1.什么是MTF MTF(move-to-front)是一种数据编码方式,用于提高数据压缩技术效果。 在数据压缩算法中,MTF可以作为一个额外的步骤。也就是说 ,可以先进行MTF编码,在进行数据压缩。2.MTF基本原理 主要使用的是数据的”空间局部性“,也就是最近出现过的字符很可能在接下来的文...
分类:其他好文   时间:2014-06-02 12:39:23    阅读次数:492
不用加减乘除做加法
问题描述 写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。 算法描述 从二进制运算入手, 1.a^b求出各bit的和, 2.a&b求出需要进位的bits, 3 4.重复1、2、3直至a&b==0(即进位为0),得到结果。 代码 int add(int num1,int num2) { if(num2==0) retu...
分类:其他好文   时间:2014-06-02 12:38:46    阅读次数:225
每日算法之二十六:Substring with Concatenation of All Words
给定一个字符串,然后再给定一组相同长度的单词列表,要求在字符串中查找满足以下条件的起始位置: 1)从这个位置开始包含单词列表中所有的单词,且每个单词仅且必须出现一次。 2)在出现的过程中不能出现其他的干扰单词。 3)出现的位置可能有多个。 4)单词的出现顺序不做要求。 下面是一个例子: S:"barfoothefoobarman" L:"foo","bar" 位置0是出现位置,;两个单词均出现仅出...
分类:其他好文   时间:2014-06-02 12:38:02    阅读次数:199
算法竞赛入门经典训练指南
在你的王国里有一条n个头的恶龙,你希望雇一些骑士把它杀死(即砍掉所有头)。村里有m个骑士可以雇佣,一个能力值为m的骑士可以砍掉一个直径不超过x的头,且需要支付x个金币。如何雇佣骑士才能砍掉恶龙的所有头,且需要支付的金币最少?注意,一个骑士只能砍一个头(且不能被雇佣两次)。...
分类:其他好文   时间:2014-06-02 12:25:09    阅读次数:193
统治世界的十大算法
boxi? 21:49 / 01统治世界的十大算法软件正在统治世界。而软件的核心则是算法。算法千千万万,又有哪些算法属于“皇冠上的珍珠”呢?Marcos Otero 给出了他的看法。什么是算法?通俗而言,算法是一个定义明确的计算过程,可以一些值或一组值作为输入并产生一些值或一组值作为输出。因此算法就...
分类:其他好文   时间:2014-06-02 12:00:14    阅读次数:173
LeetCode: Same Tree [100]
【题目】 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 and the nodes have the same value. 【题意】 判断了两个二叉树是否相等 【思路】 递归...
分类:其他好文   时间:2014-06-02 11:03:03    阅读次数:205
LeetCode: Interleaving String [097]
【题目】 Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbbaccc", return false. 【题意】 给定字符串s1,s2,s3, 判断s3是不是s1和s2中的字交叉组合...
分类:其他好文   时间:2014-06-02 10:58:24    阅读次数:211
LeetCode: Recover Binary Search Tree [099]
【题目】 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. Note: A solution using O(n) space is pretty straight forward. Could you devise a constant space solution? confused what "{1,#,2,3}" ...
分类:其他好文   时间:2014-06-02 10:38:17    阅读次数:246
LeetCode: Validate Binary Search Tree [098]
【题目】 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 subtree of a node contains only nodes with ke...
分类:其他好文   时间:2014-06-02 10:29:55    阅读次数:257
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!