User Tools

Site Tools


haas:fall2013:common:data-p05-20121205130000

Binary Trees Project

Objective

The purpose of this project is to continue to test your understanding of core data structures, along with fluency in modular implementation.

Expect to pay attention to linked lists, stacks, queues, and binary trees.

Overview

As we saw in class

Points I will look to evaluate:

  • functions that get the bulk of their data via passed parameters
  • code is consistently indented and well documented
  • can perform tree operations iteratively
  • can perform tree operations recursively
  • can perform tree operations with a stack
  • uses a queue to store input prior to processing
  • utilization of a function pointer for tree operations
  • building and sorting operations work regardless of algorithmic backend

Optionally, if you take on and are successful at the challenge, you can earn an extra point.

Potential sample output of this desired program:

lab46:~/src/data/submit/p05$ ./treeprog

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 1

Enter value (-1 to quit): 34
Enter value (-1 to quit): 39
Enter value (-1 to quit): 83
Enter value (-1 to quit): 12
Enter value (-1 to quit): 6
Enter value (-1 to quit): 8
Enter value (-1 to quit): 44
Enter value (-1 to quit): 36
Enter value (-1 to quit): 26
Enter value (-1 to quit): -1

Input Queue is Built

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 2

34, 39, 83, 12, 6, 8, 44, 36, 26

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 4

Binary Tree Operations will be done RECURSIVELY

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 6

Tree Built from input queue

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 7

Traversing to show least to greatest:
6, 8, 12, 26, 34, 36, 39, 44, 83

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 8

Traversing to show greatest to least:
83, 44, 39, 36, 34, 26, 12, 8, 6

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 9

                        34
            12                     39
     06            26        36          83
        08                            44

[[ Binary Tree Fun ]]
---------------------
1. Build input queue
2. Display input queue
3. Iterative Tree Operations
4. Recursive Tree Operations
5. Stack-Based Tree Operations
6. Build tree from input queue
7. Traverse tree to show least to greatest
8. Traverse tree to show greatest to least
9. Display Binary Tree (CHALLENGE)
0. Quit

Enter Selection: 0                                    
lab46:~/src/data/submit/p05$ 
haas/fall2013/common/data-p05-20121205130000.txt · Last modified: 2012/11/04 11:08 by 127.0.0.1