Starting from:

$25

CSE102-Homework 4 Solved

CSE 102 Homework Assignment 4

Description

–    Each node is represented by a single character. They are separated by comma. Branching is described by matching parentheses.

–    The length of the text will not be greater than 250

•     Below is an example of a tree description:

(A,(c,B,e),K,D,e,(f,(d,F))) • This tree can be visualized as follows:

-A

--c

--B

--e

-K

-D

-e

--f

---d

---F

•     Another example:

(A,(A,A,(A),A),A)

•     Visualization:

-A --A

--A

---A

--A

-A

•     Another example:

A,(A,A,(A),A),A

•     Visualization:

A

-A

-A

--A

-A

A

•     Your program will read the simplified newick formatted tree description from a file and write the visualization of the described tree to output.txt.

•     Core part of your implementation (parsing and creating visualization) should utilize recursion otherwise you will get 0pts. For this problem, coding without recursion is significantly easier.

•     Pay attention to the structure of the output. If your program prints something slightly different or anything extra, you will loose at least 30pts. Don’t print any debug messages or greeting texts. Don’t add extra spaces, newlines, commas etc...

More products