PPS QB!
PPS QB!
Problem Statement: Given a list of numbers, find and return the maximum (largest)
number in the list.
Algorithm:
1. Start
2. Initialize a variable max to negative infinity (or any very small number).
3. Initialize an empty list, say numbers, with the given list of numbers.
4. For each element num in the numbers list, repeat steps 5-7.
5. If num is greater than the current value of max, update max to be equal to
num .
6. Move to the next element in the numbers list.
7. End of loop.
8. max now contains the maximum number.
9. Return max.
10. End
Now, let's apply this algorithm to a list of numbers: [12, 5, 27, 8, 41, 19]
After looping through all the numbers, max contains the maximum value, which is
41. Therefore, the algorithm returns 41 as the maximum number in the list.
1. Trial and Error: In this strategy, you try different solutions one
after the other until you find one that works. This approach is often
used for simple or routine problems and can be time-consuming.
2. Algorithmic Thinking: Algorithmic thinking involves breaking
down a problem into smaller, discrete steps or actions that can be
clearly defined and executed. It's particularly useful for well-defined
problems where a systematic approach is needed.
3. Heuristic Approach: Heuristics are rules of thumb or shortcuts
used to quickly arrive at a satisfactory solution. While heuristics may
not guarantee the optimal solution, they are often effective for
making decisions in a reasonable amount of time. Examples include
the "rule of thumb" or "gut feeling."
4. Root Cause Analysis: This strategy involves identifying the
underlying causes of a problem rather than just addressing its
symptoms. Techniques like the "5 Whys" method are commonly
used to delve deeper into the root causes of issues.
5. Critical Thinking: Critical thinking involves evaluating information
and arguments carefully and logically to arrive at well-informed
decisions. It emphasizes analyzing evidence, considering
alternatives, and making informed judgments.
6. Brainstorming: Brainstorming is a creative problem-solving
strategy that encourages generating a large number of ideas or
solutions, often in a group setting. The focus is on quantity rather
than quality at first, with the idea that creative solutions may
emerge from the process.
7. Divide and Conquer: This strategy involves breaking a complex
problem into smaller, more manageable sub-problems. Each sub-
problem is solved individually, and their solutions are combined to
address the larger problem.
8. Simulation and Modeling: Simulation involves creating a
simplified representation of a problem or system to gain insights
and test potential solutions without real-world consequences. It's
commonly used in fields like engineering and economics.
9. Decision Trees: Decision trees are graphical representations that
help in decision-making by mapping out various options and their
potential outcomes. This strategy is often used in scenarios with
multiple decision points and uncertainty.
10. Analytical Problem Solving: This approach involves
systematically analyzing data, statistics, and facts to arrive at a
solution. It's common in fields like data analysis and scientific
research.
11. Consulting Experts: Sometimes, the best strategy is to seek
advice or guidance from experts in the relevant field who have
experience solving similar problems.
12. A/B Testing: In the context of decision-making and problem-
solving, A/B testing involves comparing two or more variations of a
solution or approach to determine which one performs better.
13. Creativity Techniques: Various creativity techniques, such
as mind mapping, lateral thinking, and the SCAMPER method,
encourage innovative thinking and idea generation.
14. SWOT Analysis: SWOT (Strengths, Weaknesses,
Opportunities, Threats) is a strategic planning tool that helps in
identifying internal and external factors affecting a situation. It is
often used in business and project management.
15. Cost-Benefit Analysis: This strategy involves evaluating the
costs and benefits associated with different solutions to determine
which one provides the best overall value.
OR
2. Input exam_score
7. End
In this algorithm:
1. Start
2. Input marks for subject 1 (marks_subject1)
3. Input marks for subject 2 (marks_subject2)
4. Input marks for subject 3 (marks_subject3)
5. Calculate the sum of marks_subject1, marks_subject2, and
marks_subject3 and store it in total_marks.
6. Calculate the average by dividing total_marks by 3 (since there are
three subjects) and store it in average_marks.
7. Display "The average marks of the student in three subjects are:",
average_marks.
8. End