Answer:
By Using the Greedy- Activity- Selection algorithm
Explanation:
The Greedy- Activity- Selection algorithm in this case involves
First finding a maximum size set S1, of compatible activities from S for the first lecture hall.
Then using it again to find a maximum size set S2 of compatible activities from S - S1 for the second hall.
This is repeated till all the activities are assigned.
It requires θ(n2) time in its worse .
Hmm... I feel like this query is much broader than it should be. However, I will start my initial answer, then another potential solution.
My initial answer to your query was: A condition controlled loop is used to control the number of times a loop iterates.
The potential answer, my secondary one, is: A count controlled loop iterates a specific number of times.
Two results, but my initial answer is the solution I opted when understanding this.
Answer:
You need exit condition like If, otherwise method will repeat endlessly.