mirror of
https://github.com/AdrianKuta/Tree-Data-Structure.git
synced 2025-07-01 15:27:58 +02:00
Set up GitHub Actions
This commit is contained in:
@ -41,6 +41,7 @@ open class TreeNode<T>(val value: T) : Iterable<TreeNode<T>>, ChildDeclarationIn
|
||||
* @return `true` if the node has been successfully removed; `false` if it was not present in the tree.
|
||||
*/
|
||||
fun removeChild(child: TreeNode<T>): Boolean {
|
||||
println(child.value)
|
||||
val removed = child._parent?._children?.remove(child)
|
||||
child._parent = null
|
||||
return removed ?: false
|
||||
|
@ -43,7 +43,8 @@ class TreeNodeTest {
|
||||
"│ └── Milk Shake\n" +
|
||||
"└── Curd\n" +
|
||||
" ├── yogurt\n" +
|
||||
" └── lassi\n", root.toString()
|
||||
" └── lassi\n",
|
||||
root.prettyString()
|
||||
)
|
||||
|
||||
println("Remove: ${curdNode.value}")
|
||||
@ -56,7 +57,8 @@ class TreeNodeTest {
|
||||
" ├── tea\n" +
|
||||
" │ └── normal tea\n" +
|
||||
" ├── coffee\n" +
|
||||
" └── Milk Shake\n", root.toString()
|
||||
" └── Milk Shake\n",
|
||||
root.prettyString()
|
||||
)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user