码迷,mamicode.com
首页 >  
搜索关键字:算法    ( 83296个结果
LeetCode: Unique Binary Search Trees [095]
【题目】 Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ / / / \ 3 2 1 ...
分类:其他好文   时间:2014-06-01 15:34:24    阅读次数:231
LeetCode: Unique Binary Search Trees II [096]
【题目】 Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example, Given n = 3, your program should return all 5 unique BST's shown below. 1 3 3 2 1 \ / / / \ ...
分类:其他好文   时间:2014-06-01 15:33:45    阅读次数:297
背包问题问法的变化(背包九讲)
前言:         以上涉及的各种背包问题都是要求在背包容量(费用)的限制下求可以取到的最大价值,但背包问题还有很多种灵活的问法,在这里值得提一下。但是我认为,只要深入理解了求背包问题最大价值的方法,即使问法变化了,也是不难想出算法的。例如,求解最多可以放多少件物品或者最多可以装满多少背包的空间。这都可以根据具体问题利用前面的方程求出所有状态的值(f数组)之后得到。还有,如果要求的是“总价值...
分类:其他好文   时间:2014-06-01 15:32:16    阅读次数:278
LeetCode: Reverse Linked List II [092]
【题目】 Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4, return 1->4->3->2->5->NULL. Note: Given m, n satisfy the following condition: 1 ≤ m ≤ n ≤ length of list. 【题意】 ...
分类:其他好文   时间:2014-06-01 15:08:34    阅读次数:237
【leetcode】Permutations
问题: Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]. 分析: ...
分类:其他好文   时间:2014-06-01 15:04:42    阅读次数:259
BFS判断是否是二分图Bipartite算法
二分图bipartite 使用BFS广度优先判断一个图是否是二分图。基本图操作。 参考 http://www.geeksforgeeks.org/bipartite-graph/ #pragma once #include #include #include using namespace std; class CheckwhetheragivengraphisBipa...
分类:其他好文   时间:2014-06-01 15:03:24    阅读次数:288
五类常见算法小记 (递归与分治,动态规划,贪心,回溯,分支界限法)
5类算法小结: 递归与分治法, 动态规划, 贪心算法, 回溯法, 分支界限法...
分类:其他好文   时间:2014-06-01 13:59:44    阅读次数:269
LeetCode: Restore IP Addresses [093]
【题目】 Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example: Given "25525511135", return ["255.255.11.135", "255.255.111.35"]. (Order does not matter) 【题意】 给定一个字符串,恢复并返回所有符合条件的IP串 【思路】...
分类:其他好文   时间:2014-06-01 13:01:56    阅读次数:295
LeetCode: Binary Tree Inorder Traversal [094]
【题目】 Given a binary tree, return the inorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [1,3,2]. Note: Recursive solution is trivial, could you do it iteratively? confused what "{1,#,2...
分类:其他好文   时间:2014-06-01 13:01:23    阅读次数:279
使用C++实现学生管理系统
我在前面的博客中分别使用C语言的动态数组和链表实现了学生成绩管理系统,最近正好在学习C++,于是我便使用C++实现了学生成绩管理系统,算法和前面的C语言的动态数组实现的学生成绩管理系统差不多,只是在动态内存分配上使用了C++的New,而C语言中使用的是malloc,在排序中使用了插入排序 我的使用C语言实现的学生成绩管理系统:http://blog.csdn.net/u010105970/art...
分类:编程语言   时间:2014-06-01 13:00:05    阅读次数:447
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!