TREE TRAVERSAL EXAMPLE

INPUT DATA:

 

[CSC course codes]                                                   Binary Search Tree constructed:

 

300                                                                                                         300        

210                                                                        

400                                                                         210                                                         400

150

220                                                         150                         220                           370                       450

370

450                                                100          175         215       250                325       390            425            470       

100

175

215

250

325

390

425

470

 

IN-ORDER                                                           PRE-ORDER

 

100                                                                         300

150                                                                         210

175                                                                         150

210                                                                         100

215                                                                         175

220                                                                         220

250                                                                         215

300                                                                         250

325                                                                         400

370                                                                         370

390                                                                         325

400                                                                         390

425                                                                         450

450                                                                         425

470                                                                         470

 

POST-ORDER

 

100

175

150

215

250

220

210

325

390

370

425

470

450

400

300