Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[10] A bunch of UTM students, who were good friends of each other, went out for a trip to Niagara Falls together, and.., long story

image text in transcribed

[10] A bunch of UTM students, who were good friends of each other, went out for a trip to Niagara Falls together, and.., long story short, something happened and some of them stopped being friends and don't want to see each other ever again. After getting back to UTM, they realize that there is a money problem they need to solve: They haven't yet split the cost incurred in the trip evenly. Some of them spent more than they should and therefore are owed some amount of money, while some others spent less than they should and therefore owe some amount of money. This wouldn't have been a problem f everybody coulds talk to each other. But now since some of them are no longer friends, it might be impossible for everyone to even out the money You, as an outsider and a CSC263 trained computer scientist, want to help out, so you ask each person to tell you how much money she owes or is owed, and with whom she is still friends. Given this information, you will figure out whether it's possible for everyone to get even, with money only being given between persons who are stll friends The input for your algorithm consists of two lists owing and friendship. The length of the list owing is the total number of students; owing [i] is the amount that student i s owing (0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Occupational Safety and Health Act?

Answered: 1 week ago

Question

What are the classifications of Bank?

Answered: 1 week ago