You are given two array of “n” length. First array contains the starting time of meetings. Second array contains the ending time of those meetings. Write an algorithm that detects meeting conflicts.
1 Allocate array indx[] of size n
2 Set perev_min equal 0
3 Set i equal 0
4 In the array of starting time find the minimal element that is greater than prev_min
5 Set prev_min equal to the value found at step 4 and set indx[i] equal its index
6 Increment i by 1
7 Repeat steps 4 - 7 until i < n
8 Set i equal 0
9 If stating time [indx[i+1]] is before ending time [indx[i]] return "meetings have conflict"
10 Increment i by 1
11 Repeat steps 9 and 10 until i < n-1
12 Return "meetings have no conflict"
Comments
Leave a comment