This assessment requires you to be able to apply the theories and knowledge you have learned to solve problems and questions related to modules 1-3. This demonstrates your ability to use the knowledge to answer unseen and complex problems.
Instructions:
1. Make sure you engage with the course content for modules 1-4 and 5.1 before the exam.
2. Make sure you answer every question and show your working every time.
3. Exam conditions apply, follow the directions of your lecturer at all times
4. Answer all questions.
5. Calculators are allowed for this exam.
6. Show working!
a. Partial marks may be allocated for working.
b. Full marks will be given for correct answers only if required justification is included with the answer.
7. Make sure your code is well-documented and properly indented. See some general guidelines for indentation at https://www2.cs.arizona.edu/~mccann/indent_c.html and documentation at http://www.edparrish.net/common/cppdoc.html.
8. You can give any file name to your code but your file containing the main function should be named using your student id. You may break your code into small modules and put them in header files for reusability.
9. When you submit your code ensure that there are no logical, syntax, semantics or run time error. If you are using pointers, avoid memory leaks. While assessing the code, if we run into any of these problems you will lose marks.
10. Your program is expected to take all its input only from a text file and dump its output in text file (and optionally on screen if specified). There will be no user interaction involved while running the program.
11. The name of the input file and output file for each question will be specified in the question so you can hardcode it in your programs. Both the files will be in the same directory as the source program.
12. Avoid using subdirectories but if you must use relative paths in code to refer to them.
13. Put all your source code in a folder and name the folder with your student id. ZIP the folder and submit the folder on LMS. The folder should not contain anything except your source code (no .exe, .txt files)
Question 1:
Input file: input-q1a2.txt
Output file: output-q1-a2.txt
You are required to create an AVL tree by inserting numbers. Numbers that need to be inserted are given in the input file. After each insertion, write the contents of the tree in the output file using breadth-first traversal. Print the level and then the values at that level (root is at level 0). In the input file first line contains the number of data elements. The second line contains all the data elements separated by space.
Sample input file:
8
23 12 5 8 10 21 11 17
Interpretation: Line 1 says that there are 8 numbers to be inserted in the tree. Line 2 has all the 8 numbers separated by space.
Output file:
1: 8 21
2: 5 10 17 23
3: 11
...
...
Question 2:
Input file: input-q2a2.txt
Output file: output-q2-a2.txt
You are required to create a binary max heap by inserting numbers (you may use arrays or dynamic data structure). Numbers that need to be inserted are given in the input file. After each insertion, write the contents of the heap, before and after the heap operation in the output file. In the input file, first line contains the number of data elements. The second line contains all the data elements separated by space.
Sample input file:
8
23 12 5 8 10 21 11 17
Interpretation: Line 1 says that there are 8 numbers to be inserted in the heap. Line 2 has all the 8 numbers separated by space.
Output file: (if doing breadth-first traversal or in case of an array, simple print the contents)
23
23
23 12
23 12
23 12 5
23 12 5
23 12 5 8
23 12 5 8
23 12 5 8 10
23 12 5 8 10
23 12 5 8 10 21
23 21 5 12 10 8
...
...
Project Management:
1. Source control: It is recommended that you use Git for your version control with a cloud based service for hosting such as BitBucket or GitHub.
2. Agile tools: Use a free collaborative service such as Trello or HacknPlan to organise and measure your development.
Technical Requirements:
1. Appropriate, effective and correct usage of C or C++
2. Object Orientated Programming best practices are used
3. Implemented in Windows / Linux
Build Quality:
The source code is required to display the following features:
1. Free of:
a. Build warnings at Warning Level 3 for all build targets.
b. Build errors for all build targets.
c. All intermediate files, (.obj, .pdb, .ilk, …, files etc).
2. For C++ projects, an electronic copy of the source code (.cpp), solution file (.sln) and project file (.vcxproj) is required.
a. Name the source code folder as: Source – Student Name
b. Name the solution as: YourName.sln
Runtime Quality:
The build is required to display the following features:
1. Free of:
a. Bugs.
b. Crashes.
Code structure & Commenting:
Code should be structured to reflect the best practices where possible for object-oriented design.
Code should be commented in your own words to demonstrate understanding where applicable.
Any third-party code should be appropriately attributed to the source and any licensing should be included in both the runtime & source.