This repo has two tests
- Sort
- Sorting the input data based on the no of occurrences
- Tree
- Finding the least/min time to burn the tree
Two programs are simple java 8 based console applications, which supports custom data, and hard-coded input modes. Default mode is hard-coded, to enable custom input provide single argument with value 1
$ cd sort/
$ javac SortByOccurrences.java
$ java SortByOccurrences [1]
[1] is optional and if provided program asks for user input. Input should be in the format of
x,y,z,...
Example: ref below image
$ cd tree/
$ javac BinaryTreeTraversal.java
$ java BinaryTreeTraversal [1]
[1] is optional and if provided program asks for user input. Input should be in the format of
N
N-1 entries of [parent, child] one per each line
L leaf node
Example: ref the image