Sunday 7 June 2015

CS301 - Data Structures Assignment No. 2 Solution Fall Spring 2015 Due Date:Jun 09, 2015

Assignment No. 02 (Graded)
SEMESTER Spring 2015
CS301- Data Structures
Total Marks: 20
Due Date:09-06-2015
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
  • The assignment is submitted after due date.
  • The submitted assignment is other than .cpp file.
  • The submitted assignment does NOT open or file is corrupted.
  • The assignment is copied (from other student or ditto copy from handouts or internet).

Note: you are required to write C++ code only in dev-C++ IDE.

Uploading instructions

  • For clarity and simplicity, you are required to Upload/Submit only .cpp file.
Objective
The objective of this assignment is:

To give you the practical implementation of Binary Search Tree
Problem Statement:
ICC - International Cricket Council is an international governing body for the game of cricket.ICC is fully responsible for the governance and organization of all major international cricket tournaments.
One of the major responsibilities of ICC is to award ranking to different teams of cricket based on their performance in a specific format of cricket in a calendar year.
Following is a sample performance table of different teams constituted by ICC for year 2014:

Team
Matches
Points
Rating
Australia
59
7221
122
India
77
8910
116
South Africa
62
6926
112
New Zealand
54
5851
108
Sri Lanka
89
9535
107
England
62
6271
101
Pakistan
66
6264
95
West Indies
57
5246
92
Bangladesh
38
2889
75

You have studied Binary Search Tree (BST) for strings in this course. Keeping in mind the property of Binary Search Tree (BST) for string, write a program in C++ which performs the following operations:
  1. Store BST for the above teams in computer memory along with rating of each team.
  2. Display names of all teams alphabetically along with rating points.
  3. Find and display the team having maximum rating.
Solution Guidelines:
  • Prompt the user to input rating for a team, rating score should be in the range from 1 to 200.
  • You are required only to process (consider) rating from the above table. Ignore Matches and Points.
  • Implement the tree as a tree of strings.
  • A single node must contain two values: a team name and it’s rating.
  • Use strcmp () functionto compare strings while implementing the tree of strings.
  • Use inorder traversal to display the tree in alphabetic order.
Use a function named topRating ()to find and display the top one team having highest rating.
Sample Output: The output of your solution should look like:

No comments:

Post a Comment