Messy solution.

This commit is contained in:
2022-12-08 01:31:18 +01:00
parent 8d25208c83
commit 0af89a72ba
2 changed files with 123 additions and 4 deletions

View File

@@ -1 +1,6 @@
This repository contains answers to the assignments of Advent of Coding 2022
# Advent of Code 2022 - Assignment7 javascript
Assignment 7 involves parsing linux directory commands/results into a tree. The solution defines a root TreeNode first and sets it as currentdirectory. Whenever a cd command is found a new node is created if it does not exist and set to currentdir. Whenever a cd .. is found currentdirectory is set to parent. Whenever a file is found size is recursively increased for current node and parent nodes.
## References
- https://adrianmejia.com/data-structures-for-beginners-trees-binary-search-tree-tutorial/
- https://stackoverflow.com/questions/8376525/get-value-of-a-string-after-last-slash-in-javascript