本应用主要解决二叉树进行可视化,并提供多种遍历方式展示
服务端返回数据: nodes = [{id: 1, value: 'one', color: 'red', left: 2, right: 3 } ,{id: 5, value: 'five', color: 'red', left: null, right: null } ,{id: 2, value: 'two', color: 'blue', left: 4, right: null } ,{id: 4, value: 'four', color: 'red', left: null, right: null } ,{id: 3, value: 'three', color: 'green', left: 5, right: 6 } ,{id: 6, value: 'six', color: 'red', left: null, right: null }]
要求:
- 实现函数 前序遍历/中序遍历/后序遍历, 打印出每个节点的value和color (ES6实现)
- 实现以上过程的可视化展现 a. 树的静态展现, 同节点要根据color展现颜色,并用文字展现value, b. 可以让用户选择查看哪种算法(前序遍历/中序遍历/后序遍历),算法的动态展示,比如前序遍历,通过高亮node节点,告知该算法的遍历顺序
This project was generated with Angular CLI version 6.0.5.
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory. Use the --prod
flag for a production build.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via Protractor.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI README.