Help with greedy algortitm please

  • Thread starter steve22
  • Start date
In summary, the conversation is about a problem with a greedy algorithm and how to apply it to a scenario involving ten students and eight available modules. The goal is to minimize the number of students who have a timetable clash. The original poster is confused and seeking help on how to solve the problem. Another person expresses their confusion and asks for assistance as well.
  • #1
steve22
4
0
help with greedy algortitm please!

Homework Statement



Hi Guys

I have a big problem which is bugging me. Basically the problem is about agreedy algorithm. I have attached the problem which would be similer to what I would get in the exam. I am really confused about the question I would like to get help from anyone please or example of how to solve the problem.

the problem is about

Each of ten students A-J have chosen 3 modules out of eight available as follows:

Discuss how the Greedy Algorithm can be applied to this problem and hence insert subjects into slots in such a way as to minimise the number of students who have a timetable clash. :confused:

Ive attached the problem. I would be very greatful if me anyone can help me with this question it would be very helpful to

Homework Equations





The Attempt at a Solution

 

Attachments

  • help.doc
    40.5 KB · Views: 251
Physics news on Phys.org
  • #2
Hi Guy

Does anyone know how to do this. Or am I right into thinking this is hard?

Really need help on this guys please
 
  • #3


Hello,

I understand your confusion about the problem. A greedy algorithm is a method for finding an optimal solution to a problem by making the best possible decision at each step. In this case, we want to minimize the number of students who have a timetable clash, so we need to prioritize which modules to assign to each student first.

One approach could be to start with the student who has the fewest number of modules chosen (let's say A) and assign them the modules that have the least number of conflicts with other students. Then, move on to the student with the next fewest modules (let's say B) and assign them the modules that still have the least number of conflicts with other students. Continue this process until all students have been assigned their modules.

Alternatively, you could start with the module that has the least number of conflicts with other students and assign it to the student who has the fewest modules chosen. Then, move on to the next module with the least number of conflicts and assign it to the next student with the fewest modules chosen. Continue this process until all modules have been assigned.

I hope this helps you understand how to apply the greedy algorithm to this problem. If you are still struggling, I suggest reaching out to your classmates or instructor for further clarification. Good luck!
 

1. What is a greedy algorithm?

A greedy algorithm is a problem-solving technique that makes the best possible choice at each step in order to find the overall optimal solution. It is a type of heuristic algorithm that aims to find the locally optimal solution, without considering the global optimum.

2. How does a greedy algorithm work?

A greedy algorithm works by making the best possible choice at each step without considering the future consequences. It starts with an empty solution and then iteratively adds the next best element until the entire solution is complete.

3. What are the advantages of using a greedy algorithm?

Some advantages of using a greedy algorithm include simplicity, efficiency, and fast execution time. Greedy algorithms are relatively easy to implement and can provide a good approximation for the optimal solution in a short amount of time.

4. What are the limitations of a greedy algorithm?

Greedy algorithms do not guarantee the optimal solution in all cases. They may provide a suboptimal solution or get stuck in a local optimum. Additionally, greedy algorithms are not suitable for problems that require backtracking or dynamic programming.

5. What are some real-world applications of greedy algorithms?

Greedy algorithms are commonly used in a variety of applications, such as making change, scheduling tasks, and finding the shortest path in a graph. They are also used in computer networking, data compression, and in some machine learning algorithms.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
771
  • Engineering and Comp Sci Homework Help
Replies
6
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
823
  • Engineering and Comp Sci Homework Help
Replies
2
Views
1K
  • Programming and Computer Science
Replies
1
Views
737
  • Engineering and Comp Sci Homework Help
Replies
2
Views
985
  • Engineering and Comp Sci Homework Help
Replies
9
Views
999
  • Engineering and Comp Sci Homework Help
Replies
1
Views
946
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
Back
Top