⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tree-tree.html

📁 经典的数据结构源代码(java 实现)
💻 HTML
字号:
<html><head><title>Code Fragment</title></head><body text=#000000><center></center><br><br><dl><dd><pre><font color=#ff0080>/** * An interface for a tree where nodes can have an arbitrary number of children. */</font><font color=#8000a0>public</font> <font color=#8000a0><font color=#ff8000>interface</font> </font>Tree&lt;E&gt; {  <font color = #ff0080>/** Returns the number of nodes in the tree. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>int</font> <font color=#0000ff>size</font>();  <font color = #ff0080>/** Returns whether the tree is empty. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>boolean</font> <font color=#0000ff>isEmpty</font>();  <font color = #ff0080>/** Returns an iterator of the elements stored in the tree. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Iterator&lt;E&gt; <font color=#0000ff>iterator</font>();  <font color = #ff0080>/** Returns an iterable collection of the the nodes. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Iterable&lt;Position&lt;E&gt;&gt; <font color=#0000ff>positions</font>();  <font color = #ff0080>/** Replaces the element stored at a given node. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>E <font color=#0000ff>replace</font>(Position&lt;E&gt; v, <font color=#8000a0>E </font>e)    <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Returns the root of the tree. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>root</font>() <font color=#8000a0><font color=#ff8000>throws</font> </font>EmptyTreeException;  <font color = #ff0080>/** Returns the parent of a given node. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Position&lt;E&gt; <font color=#0000ff>parent</font>(Position&lt;E&gt; v)    <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException, BoundaryViolationException;  <font color = #ff0080>/** Returns an iterable collection of the children of a given node. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font>Iterable&lt;Position&lt;E&gt;&gt; <font color=#0000ff>children</font>(Position&lt;E&gt; v)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Returns whether a given node is internal. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>boolean</font> <font color=#0000ff>isInternal</font>(Position&lt;E&gt; v)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Returns whether a given node is external. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>boolean</font> <font color=#0000ff>isExternal</font>(Position&lt;E&gt; v)     <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;  <font color = #ff0080>/** Returns whether a given node is the root of the tree. */</font>  <font color=#8000a0><font color=#8000a0>public</font> </font><font color=#8000a0>boolean</font> <font color=#0000ff>isRoot</font>(Position&lt;E&gt; v)    <font color=#8000a0><font color=#ff8000>throws</font> </font>InvalidPositionException;}</dl></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -