联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> C/C++编程C/C++编程

日期:2019-05-29 11:05

1. General Instructions

For this assignment you will implement functions in C for an AVL Tree. You are given a

skeleton C code in the following files:

avl.h

avl.c

main.c

and the file with values that should be read and added to the AVL Tree for testing your code:

input.txt

and a make file for compiling the code on the School's server:

Makefile

Complete the missing functions or parts of functions in the skeleton code. You should use the

same names of files, functions, and variables as we specified in the skeleton code. This is

because our grading will be based on a script that assumes that you use the same

names. Make sure your code compiles without errors using the provided makefiles for the

two abstract data structures on the ENGR server.

What to submit: Please submit only the two completed C files -- avl.c and main.c -- via

TEACH by the deadline. Please do not submit the header, compiled object or executable files.

Questions regarding HW4 should be posted to HW4 Discussions on Canvas for fast response.

2. AVL Tree

The main function performs the following:

Initializes an empty AVL tree.

Reads values from an input file and adds them to the AVL tree.

Prints on the terminal all values of the AVL tree in the breadth-first fashion.

Finds the minimum-cost path in the AVL tree (see details below).

Prints the execution time for finding the min-cost path, on the terminal.

Prints values of nodes that lie on the minimum-cost path in the AVL tree, on the terminal.

The order of nodes in the print-out must strictly follow their order in the min-cost path from

the root to the leaf.

Prints a cost of the min-cost path of the AVL tree, on the terminal.

Your task is to complete the missing functions or parts of functions in avl.c and

main.c. Search for the comment "FIX ME" to find which functions you need to complete. The

comments before each function are aimed at clarifying the function's input

arguments, outputs, and what the function is supposed to do. Note that we will test your code

with another input.txt file.

4. Grading policy: Max 100 points

25 points: The code runs without memory issues, but does not print out the correct AVL tree,

and does not compute the correct minimum-cost path.

50 points: The code prints out the correct AVL tree, but does not compute the correct

minimum-cost path.

85 points: The code prints out the correct AVL tree, computes the correct minimum cost, but

does not print out nodes of the min-cost path in the correct order from the root to the leaf

(e.g., some nodes are missing, or wrongly swapped).

100 points: The code prints out the correct AVL tree, and nodes of the min-cost path in the

correct order from the root to the leaf.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp