 Is It A Tree?

Description
A tree is a wellknown data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties.
There is exactly one node, called the root, to which no directed edges point.
Every node except the root has exactly one edge pointing to it.
There is a unique sequence of directed edges from the root to each node.
For example, consider the illustrations below, in which nodes are represented by circles and edges are represented by lines with arrowheads. The first two of these are trees, but the last is not.In this problem you will be given several descriptions of collections of nodes connected by directed edges. For each of these you are to determine if the collection satisfies the definition of a tree or not.
InputThe input will consist of a sequence of descriptions (test cases) followed by a pair of negative integers. Each test case will consist of a sequence of edge descriptions followed by a pair of zeroes Each edge description will consist of a pair of integers; the first integer identifies the node from which the edge begins, and the second integer identifies the node to which the edge is directed. Node numbers will always be greater than zero.
OutputFor each test case display the line "Case k is a tree." or the line "Case k is not a tree.", where k corresponds to the test case number (they are sequentially numbered starting with 1).
Sample Input6 8 5 3 5 2 6 4
5 6 0 08 1 7 3 6 2 8 9 7 5
7 4 7 8 7 6 0 03 8 6 8 6 4
5 3 5 6 5 2 0 0
1 1
Sample OutputCase 1 is a tree.
Case 2 is a tree.
Case 3 is not a tree.
Is It A Tree? 判断问题_course
20190927Language: Is It A Tree? Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 43913 Accepted: 14247 Description A tree is a wellknown data structure that is either empty (null, void, nothing) or is a set of one or more nodes connected by directed edges between nodes satisfying the following properties. There is exactly one node, called the root, to which no directed edges point. Every node except the root has exactly one edge pointing to it. There is a unique sequence of directed edges from the root to each node. For example, consider the illustrations below, in which nodes are represented by circles and edges are represented by lines with arrowheads. The first two of these are trees, but the last is not. In this problem you will be given several descriptions of collections of nodes connected by directed edges. For each of these you are to determine if the collection satisfies the definition of a tree or not. Input The input will consist of a sequence of descriptions (test cases) followed by a pair of negative integers. Each test case will consist of a sequence of edge descriptions followed by a pair of zeroes Each edge description will consist of a pair of integers; the first integer identifies the node from which the edge begins, and the second integer identifies the node to which the edge is directed. Node numbers will always be greater than zero. Output For each test case display the line "Case k is a tree." or the line "Case k is not a tree.", where k corresponds to the test case number (they are sequentially numbered starting with 1). Sample Input 6 8 5 3 5 2 6 4 5 6 0 0 8 1 7 3 6 2 8 9 7 5 7 4 7 8 7 6 0 0 3 8 6 8 6 4 5 3 5 6 5 2 0 0 1 1 Sample Output Case 1 is a tree. Case 2 is a tree. Case 3 is not a tree.
关于解Is it a tree的题_course
20120716我现在在做一道关于树的题，看了半天没想出一个解决的方法来，网上搜到的解题方法没看明白，希望有人能帮我详细的解答一下，并讲解一下其中所用到的算法是如何实现的 谢谢了 Is It A Tree? Desc
 下载 JavaScript中URL编码函数代码
 博客 Java基础系列之ArrayList的增加、删除、扩容
 博客 20201028
 下载 Jquery跨域获得Json时invalid label错误的解决办法
 下载 asp中格式化HTML函数代码 SDCMS加强版
 博客 8.10 头文件剖析：变量声明
 博客 JavaScript中的 Function
 博客 MyBatis中#{}和${}
 博客 8.13 头文件剖析：头文件路径（下）
 学院 20年设计模式教程/head first/java面试题/idea/s
 学院 Flutter编程指南之Dart语言：移动开发语言
 下载 js中top、clientTop、scrollTop、offsetTop的区别 文字详细说明版
 学院 轻松搞定数据可视化
 学院 多元线性回归模型的参数与统计量深度解读基于Python编程复现
 学院 大数据分析闯关训练营 04期直播回放
 博客 20201028
 博客 [C#] CHO.Json操作Json数据
 下载 最佳JS代码编写的14条技巧
 下载 基于jquery的高性能td和input切换并可修改内容实现代码
 博客 剑指 Offer 12. 矩阵中的路径
 博客 MyBatis07(多对一、一对多)
 下载 Jquery Ajax请求代码(2)
 博客 numpy学习回顾数学函数及逻辑函数
 学院 Java微信小程序家具家居购物商城 大学生毕业设计教学视频
 博客 leetcode刷题记录：算法（三）滑动窗口算法
 下载 js数组中删除重复值的代码小结
 学院 Unity基础入门
 学院 软件测试之测试模型及方法概论
 博客 Python中Collections.counter用法
 学院 Flutter项目的调试技巧