Copyright | Copyright (C) 2021 Yoo Chung |
---|---|

License | GPL-3.0-or-later |

Maintainer | dev@chungyc.org |

Safe Haskell | Safe-Inferred |

Language | GHC2021 |

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P62.

# Documentation

atLevel :: Tree a -> Int -> [a] Source #

Collect the nodes at a given level in a list

A node of a binary tree is at level \(n\) if the path from the root to the node has length \(n-1\). The root node is at level 1.

### Examples

`>>>`

[2,2]`atLevel tree4 2`

### Notes

In the original list, this was problem 62B, and `internals`

was problem 62,
but the latter was grouped with problem 61 because the grouping was more natural.