码迷,mamicode.com
首页 >  
搜索关键字:深度优先搜索    ( 721个结果
LeetCode --- 104. Maximum Depth of Binary Tree
题目链接:Maximum Depth of Binary Tree 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 leaf node. 这道题...
分类:其他好文   时间:2015-04-16 10:25:57    阅读次数:123
LeetCode --- 105. Construct Binary Tree from Preorder and Inorder Traversal
题目链接:Construct Binary Tree from Preorder and Inorder Traversal Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that duplicates do not exist in the ...
分类:其他好文   时间:2015-04-16 10:24:42    阅读次数:137
LeetCode --- 101. Symmetric Tree
题目链接:Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \ 3 ...
分类:其他好文   时间:2015-04-16 09:06:02    阅读次数:147
用无向带权图实现校园导航系统
学校数据结构的课程实验之一。用到的数据结构:无向带权图用到的算法:Floyd最短路径算法,深度优先搜索(递归实现)需求分析: 设计一个校园导航程序,为访客提供各种信息查询服务:1.以图中各顶点表示校内各单位地点,存放单位名称,代号,简介等信息;以边表示路径,存放路径长度等相关信息。2.图中任意单位....
分类:其他好文   时间:2015-04-16 01:09:46    阅读次数:148
深度优先搜索:奇怪的电梯
DescriptionThere is a strange lift.The lift can stop can at every floor as you want, and there is a number Ki(0 2 #include 3 #include 4 #include 5...
分类:其他好文   时间:2015-04-15 21:20:22    阅读次数:206
用试探回溯法解决N皇后问题
学校数据结构的课程实验之一。数据结构:(其实只用了一个二维数组)算法:深度优先搜索,试探回溯需求分析: 设计一个在控制台窗口运行的“n皇后问题”解决方案生成器,要求实现以下功能: 由n*n个方块排成n行n列的正方形称为n元棋盘。如果两个皇后位于n元棋盘上的同一行、同一列或同一对角线上,则称它们在.....
分类:其他好文   时间:2015-04-14 23:08:11    阅读次数:255
LeetCode --- 100. Same Tree
题目链接:Same Tree 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....
分类:其他好文   时间:2015-04-14 21:41:41    阅读次数:140
LeetCode --- 98. Validate Binary Search Tree
题目链接:Validate Binary Search Tree 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 ...
分类:其他好文   时间:2015-04-14 21:41:20    阅读次数:118
LeetCode --- 99. Recover Binary Search Tree
题目链接:Recover Binary Search Tree 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 stra...
分类:其他好文   时间:2015-04-14 21:39:52    阅读次数:189
挑战程序设计竞赛 01背包变换对象
01背包式最简单的背包问题,书上是由深度优先搜索的记忆化搜索的递归实现到处递推的解决方法就是01背包,把所有i和j的情况都记下来,总共不过n*v种情况。 而01背包之2是简单01背包变换对象之后的做法。 题目描述如下: 有n个价值和花费分别为weight[i]和cost[i]的物品,把这些物品装进容量为V的背包中,求最大价值? 但是现在条件是:V<=109,weight[i]<100,n<1...
分类:其他好文   时间:2015-04-11 14:51:58    阅读次数:129
721条   上一页 1 ... 55 56 57 58 59 ... 73 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!