[Note]prufer
[Note]Prufer编码
实现
不断删除度数为\(1\)的最小序号的点,并输出与其相连的节点的序号,直至树中只有两个节点。
性质
任何一棵\(n\)节点的树都可以唯一的用长度为\(n-2\)的prufer编码表示
度数为\(m\)的节点的序号在prufer编码中出现次数为\(m-1\)。
还原
怎样将prufer编码还原为一棵树?
从prufer编码的前端开始扫描,寻找最小的且不在prufer编码中且未被标记的节点v,连接u,v并标记v,将u从prufer编码中删除。扫描下一节点。
应用
[HNOI2008]明明的烦恼
直接写出树的prufer序列。为了避免高精度除法,我们可以在质因数的指数上加加减减,最后再高精度乘法。
[Note]prufer的更多相关文章
- 三星Note 7停产,原来是吃了流程的亏
三星Note 7发售两个月即成为全球噩梦,从首炸到传言停产仅仅47天.所谓"屋漏偏逢连天雨",相比华为.小米等品牌对其全球市场的挤压.侵蚀,Galaxy Note 7爆炸事件这场连 ...
- 《Note --- Unreal --- MemPro (CONTINUE... ...)》
Mem pro 是一个主要集成内存泄露检测的工具,其具有自身的源码和GUI,在GUI中利用"Launch" button进行加载自己待检测的application,目前支持的平台为 ...
- 《Note --- Unreal 4 --- Sample analyze --- StrategyGame(continue...)》
---------------------------------------------------------------------------------------------------- ...
- [LeetCode] Ransom Note 赎金条
Given an arbitrary ransom note string and another string containing letters from all th ...
- Beginning Scala study note(9) Scala and Java Interoperability
1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class B ...
- Beginning Scala study note(8) Scala Type System
1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the h ...
- Beginning Scala study note(7) Trait
A trait provides code reusability in Scala by encapsulating method and state and then offing possibi ...
- Beginning Scala study note(6) Scala Collections
Scala's object-oriented collections support mutable and immutable type hierarchies. Also support fun ...
- Beginning Scala study note(5) Pattern Matching
The basic functional cornerstones of Scala: immutable data types, passing of functions as parameters ...
随机推荐
- 0x01 C语言-编写第一个hello world
学习每一个编程语言都是从 "Hello world!" 开始的,这好像就是编程界一条不成文的规定一样. 在这篇文章中,我将教大家编写一个可以输出 "Hello world ...
- 在centos7上安装hadoop
1.使用hadoop是需要jdk环境的,因为hadoop里面有java程序,而运行java程序需要jdk. 2.从宿主机上传文件到虚拟机有很多方法,我选择的是在虚拟机安装lrzsz,安装lrzsz命令 ...
- clr from c# 字符 ,字符串 和 文本处理
1,字符----------在.net中,字符总是16位的Unicode代码值.每个字符都是一个System.Char结构(值类型)的一个实列. using System; public class ...
- junit 常用注解 + junit 断言详解
@Test: 在junit3中,是通过对测试类和测试方法的命名来确定是否是测试,且所有的测试类必须继承junit的测试基类.在junit4中,定义一个测试方法变得简单很多,只需要在方法前加上@Test ...
- Asciidoctor-pdf生成pdf文件
本文使用asciidoc语法编写. = Asciidoctor-pdf生成pdf文件 Pinnsvin Pinnsvin@163.com v1.0 {docdate} :plantuml-server ...
- django-分页(非海量数据)
views.py class AnalysisDataHandler(View): def get(self, request): analysis_data = MonitorCenterDataA ...
- ClrFromCSharp_2_2_生成部署打包应用程序
1,在\reps\CSharpFromCSarp\CSharpFromCSarp_2_2,建立新解决方案和解决项目 并且输入以下代码 namespace ClrFromCSharp_2_2 { cla ...
- jQuery---each方法
each方法 each方法 //each方法 $("li").each(function (index, element) { $(element).css("opaci ...
- 【IDE】IDEA - 使用问题记录
1.显示方法API:类似eclipse把鼠标放到方法上有api信息. setting/keymap中搜索 quick docs:(有说默认快捷键是ctrl+q,但我的不是待查找快捷键) 2.forea ...
- matlab初探寻
matlab <iframe src="//player.bilibili.com/player.html?aid=74994893&cid=128293306&pag ...