码迷,mamicode.com
首页 >  
搜索关键字:深度优先 广度优先    ( 1990个结果
【数据结构-图】图的建立以及广度优先遍历算法
本文利用邻接表的方法将图进行了表示,并且利用广度优先遍历方法对图进行遍历 下面是一个图的示例: 代码如下: #include using namespace std; typedef int VexType; typedef struct Arcnode{ VexType data; struct Arcnode *nextarc; }ArcNode; typedef...
分类:编程语言   时间:2015-04-16 21:59:52    阅读次数:186
leetcode_107题——Binary Tree Level Order Traversal II (二叉树,广度优先搜索,队列,栈)
Binary Tree Level Order Traversal IITotal Accepted:37829Total Submissions:122499My SubmissionsQuestionSolutionGiven a binary tree, return thebottom-up...
分类:其他好文   时间:2015-04-16 12:23:02    阅读次数:176
leetcode_102题——Binary Tree Level Order Traversal(二叉树,广度优先搜索,队列)
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:其他好文   时间:2015-04-16 12:08:03    阅读次数:148
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 --- 103. Binary Tree Zigzag Level Order Traversal
题目链接:Binary Tree Zigzag Level Order Traversal Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and a...
分类:其他好文   时间:2015-04-16 10:24:56    阅读次数:116
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
LeetCode --- 102. Binary Tree Level Order Traversal
题目链接:Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#...
分类:其他好文   时间:2015-04-16 09:03:12    阅读次数:160
用无向带权图实现校园导航系统
学校数据结构的课程实验之一。用到的数据结构:无向带权图用到的算法: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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!