listout all the files of a folder to the right side of a container using vuejs

In my application, i have list of folders and each containing some files. I have to display those files while choosing particular folder. Those folder will be in left side.While selecting that folder, files will be listed out in right side. my json is like this: So if i choose ‘Animals’ folder then two files will be listed out in right side. Like these : I am new to vuejs. How can i achieve this? Answer You can list the folders on the left side and a variable files on the right side that would be updated by those of

Build tree from edge pairs and root

I’m trying to write a program that takes an array of edge pairs and turns it into a tree. I’m given a root. In this example, the root is 2. The only constraint is, each node can max have 2 children. Sample input: Expected output: Would look something like this: This is my attempt so far: Feel like this should be pretty simple but I’m missing something.. Any help? 🙂 Answer Wow, I love this question. And is pretty challenging too! This was one of my first time to take a recursive approach to a certain problem. And I think