聯系方式

您當前位置:首頁 >> 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.


版權所有:留學生編程輔導網 2018 All Rights Reserved 聯系方式:QQ:99515681 電子信箱:[email protected]
免責聲明:本站部分內容從網絡整理而來,只供參考!如有版權問題可聯系本站刪除。

体彩22选5开奖走势图百度