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.
- Make sure you engage with the course content for modules 1-4 and 5.1 before the exam.
- Make sure you answer every question and show your working every time.
- Exam conditions apply, follow the directions of your lecturer at all times
- Answer all questions.
- Calculators are allowed for this exam.
- Show working!
- Partial marks may be allocated for working.
- Full marks will be given for correct answers only if required justification is included
with the answer.
- 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.
- 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.
- 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.
- 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.
- 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
- Avoid using subdirectories but if you must use relative paths in code to refer to them.
- 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)
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:
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.
1: 8 21
2: 5 10 17 23
本网站支持淘宝 支付宝 微信支付 paypal等等交易。如果不放心可以用淘宝交易！
E-mail: email@example.com 微信:itcsdx