随笔分类 -  算法

摘要:Contains Duplicate IIIGiven an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennum... 阅读全文
posted @ 2015-06-23 14:43 imKirin 阅读(173) 评论(0) 推荐(0)
摘要:Contains Duplicate IIGiven an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[... 阅读全文
posted @ 2015-06-23 13:12 imKirin 阅读(194) 评论(0) 推荐(0)
摘要:Contains DuplicateGiven an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at leas... 阅读全文
posted @ 2015-06-23 11:11 imKirin 阅读(171) 评论(0) 推荐(0)
摘要:AVL树参考了:http://www.cppblog.com/cxiaojia/archive/2012/08/20/187776.html修改了其中的错误,代码实现并亲自验证过。 平衡二叉树(Balanced Binary Tree)是二叉查找树的一个进化体,也是第一个引入平衡概念的二叉树。19... 阅读全文
posted @ 2015-06-17 15:07 imKirin 阅读(1385) 评论(0) 推荐(0)
摘要:1, 二叉树结构struct TreeNode{ int val; TreeNode* left; TreeNode* right; TreeNode(int x) : val(x), left(NULL), right(NULL) {... 阅读全文
posted @ 2015-06-11 16:04 imKirin 阅读(299) 评论(0) 推荐(0)
摘要:转载自董的博客本文链接地址:http://dongxicheng.org/structure/knapsack-problems/1 背包问题介绍背包问题不单单是一个简单的算法问题,它本质上代表了一大类问题,这类问题实际上是01线性规划问题,其约束条件和目标函数如下:自从dd_engi在2007年推... 阅读全文
posted @ 2015-04-13 11:06 imKirin 阅读(300) 评论(0) 推荐(0)
摘要:1 /* Jeff Somers 2 * 3 * Copyright (c) 2002 4 * 5 * jsomers@alumni.williams.edu 6 * or 7 * allagash98@yahoo.com 8 * 9 * April, 2002 10... 阅读全文
posted @ 2015-03-30 14:36 imKirin 阅读(567) 评论(0) 推荐(0)