随笔分类 - Algorithm Learning
这个文件夹用于保存最近开始学习算法的一些记录。其中算法的学习,大多来自一些ACM入门的教材、算法设计等类型的教材。在这个算法学习的过程当中,第一次发现了很多算法上有意思的东西。以前虽然也有接触过一些简单的,但从来没有系统的去学习过。现在从新开始学习,希望有所收获。
摘要:1119. Pre- and Post-order Traversals (30) Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be deter
阅读全文
摘要:题目描述 给一棵二叉树的层序遍历序列和中序遍历序列,求这棵二叉树的先序遍历序列和后序遍历序列。 给一棵二叉树的层序遍历序列和中序遍历序列,求这棵二叉树的先序遍历序列和后序遍历序列。 输入 每个输入文件中一组数据。 第一行一个正整数N(1<=N<=30),代表二叉树的结点个数(结点编号为1~N)。接下
阅读全文
摘要:1087. All Roads Lead to Rome (30) Indeed there are many different tourist routes from our city to Rome. You are supposed to find your clients the rout
阅读全文
摘要:1107. Social Clusters (30) When register on a social network, you are always asked to specify your hobbies in order to find some potential friends wit
阅读全文
摘要:1106. Lowest Price in Supply Chain (25) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in mo
阅读全文
摘要:1090. Highest Price in Supply Chain (25) A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)-- everyone involved in m
阅读全文
摘要:1118. Birds in Forest (25) Some scientists took pictures of thousands of birds in a forest. Assume that all the birds appear in the same picture belon
阅读全文
摘要:1110. Complete Binary Tree (25) Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each input file contains
阅读全文
摘要:1115. Counting Nodes in a BST (30) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 时间限制 400 ms 时间限制 400 ms 内存限制 65536 kB 内存限制 6553
阅读全文
摘要:题目描述 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。现得到城镇道路统计表,表中列出了任意两城镇间修建道路的费用,以及该道路是否已经修通的状态。现请你编写程序,计算出全省畅通需要的最低成本。 省政府“畅通工程”的目标是使全
阅读全文
摘要:题目描述 省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。 省政府“畅通工程”的目标是使全省任何两个村庄间都可以
阅读全文
摘要:题目描述 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 某省调查乡村交通状况,得到的统计表中列出了任意两村
阅读全文
摘要:1030. Travel Plan (30) A traveler's map gives the distances between cities along the highways, together with the cost of each highway. Now you are sup
阅读全文
摘要:As an emergency rescue team leader of a city, you are given a special map of your country. The map shows several scattered cities connected by some ro
阅读全文
摘要:题目描述 Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course t
阅读全文
摘要:题目描述 Today is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You hav
阅读全文
摘要:题目描述 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条
阅读全文
摘要:题目描述 某市计划建设一个通信系统。按照规划,这个系统包含若干端点,这些端点由通信线缆链接。消息可以在任何一个端点产生,并且只能通过线缆传送。每个端点接收消息后会将消息传送到与其相连的端点,除了那个消息发送过来的端点。如果某个端点是产生消息的端点,那么消息将被传送到与其相连的每一个端点。为了提高传送
阅读全文
摘要:题目描述 判断两序列是否为同一二叉搜索树序列 判断两序列是否为同一二叉搜索树序列 输入 开始一个数n,(1<=n<=20) 表示有n个需要判断,n= 0 的时候输入结束。接下去一行是一个序列,序列长度小于10,包含(0~9)的数字,没有重复数字,根据这个序列可以构造出一颗二叉搜索树。接下去的n行有n
阅读全文
摘要:题目描述 输入一系列整数,建立二叉排序数,并进行前序,中序,后序遍历。 输入一系列整数,建立二叉排序数,并进行前序,中序,后序遍历。 输入 输入第一行包括一个整数n(1<=n<=100)。接下来的一行包括n个整数。 输入第一行包括一个整数n(1<=n<=100)。接下来的一行包括n个整数。 输出 可
阅读全文

浙公网安备 33010602011771号