Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Student Time scheduling algorithm

Tags:

algorithm

I need to find an algorithm to find the best time to meet up for lets say a study group. The system has information about a group of students and their class schedules. The system should give a time for meetup, where there is no conflict with anyone's class schedules. what would be the best way attack this problem. I was looking for any scheduling algorithm, but didnt find anyone that fits.

thanks in advance

like image 977
user171034 Avatar asked Jan 18 '10 15:01

user171034


1 Answers

Interesting question.

This is what I would do:

  1. First, align all timescheduals, for all students (e.g. starting on Mondays, every day devided by 24 hours). You can use a boolean or an integer for each period and store them in an array.
  2. Then perform an addition operation on all scheduals together.

Which then looks like this, for example:

Student A: 11100000111111100000
Student B: 00000011111000010001
Student C: 00000000111111110001
_______________________________+
           11100022333222220002
              ^^^          ^^^

Then you'd need to find all gaps in the array (areas with zeros) by using a simple loop which keeps track of the current zero-length. Memoize the start and end index and translate it back (reverse of step 1) to a time region.

like image 123
Pindatjuh Avatar answered Nov 09 '22 20:11

Pindatjuh