logo

Crowdly

A circular linked list (where the last node points back to the first node) is u...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

A circular linked list (where the last node points back to the first node) is used to represent a group of people sitting around a table. However, some random people at the table are found to be infected. If they are infected, they will infect the people sitting directly next to them after 1 hour.

void infection_propagation(struct Node *Header)

Write a C function infection_propagation that will take the address of the first node of a circular linked list as input argument, where each node in the linked list of type struct Node and represents a person seated at the table. The data member within the node is equal to 1 if the respective person is infected and 0 otherwise. Your function must propagate the infection around the table by calculating the number of infected people at each hour, and stop when all people at the table are infected.

struct Node {

int data;

struct Node *next;

}

Note:

  1. You may also use whatever editor/test environment you like to write your solution.

  2. Your code MUST be submitted as a .txt file below BEFORE the end of the test
  3. Your .txt file should be named as q7_studentID.txt, eg q7_12345678.txt

  4. You should use good programming practices

Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на learning.monash.edu?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!