Question #247152

  1. Suppose you have ten students in the programming-1 class; you are tasked to check which one of these students is vegetarian. Suppose five students are vegetarian. Write pseudocode, algorithms, flowchart to solve this problem 

Expert's answer

Pseudocode:


FOR i = 0; i < students.length; i++

IF students[i].vegetarian THEN

print(i + " This student is a vegetarian");

END IF

END FOR


Algorithm: linear search


FlowChart:







LATEST TUTORIALS
APPROVED BY CLIENTS