Nutrient <- Lists of nutrient necessary and need for patient
suitableIngredient <- Lists of suitable ingredient for each nutrient
FOR ALL Nutrient DO
FOR i = 0 to N-1 DO
suitableIngredient.value = suitableIngredient.nutrientValue / suitableIngredient.price // คำนวณหาวัตถุดิบที่ดีที่สุดปริมาณสารอาหาร/ราคา
END FOR
SORT suitableIngredient.value // เรียงลำดับวัตถุดิบที่ดีที่สุดจาก มากไปหาน้อย
END FOR
RETURN suitableIngredient(nutrient [0 to N-1], 0) // เลือกวัตถุดิบที่ดีที่สุดอันดับที่ 1
รบกวนช่วยดูการเขียน pseudo code แบบรู้พอรู้เรื่อง และถูกต้องมั้ยคะ
suitableIngredient <- Lists of suitable ingredient for each nutrient
FOR ALL Nutrient DO
FOR i = 0 to N-1 DO
suitableIngredient.value = suitableIngredient.nutrientValue / suitableIngredient.price // คำนวณหาวัตถุดิบที่ดีที่สุดปริมาณสารอาหาร/ราคา
END FOR
SORT suitableIngredient.value // เรียงลำดับวัตถุดิบที่ดีที่สุดจาก มากไปหาน้อย
END FOR
RETURN suitableIngredient(nutrient [0 to N-1], 0) // เลือกวัตถุดิบที่ดีที่สุดอันดับที่ 1