Lecture 2 - Algorithmic Development
Lecture 2 - Algorithmic Development
Lecture Two
Luyima Alex Cedric
[email protected]
Algorithms & Algorithmic Thinking
• Algorithms are step-by-step instructions used to solve
problems.
• Developing algorithmic thinking helps in breaking down
complex problems into smaller problems.
• The smaller problems are solved and combined to make
solutions for the large complex problem.
General Problem-solving Process
1.Define the problem: Clearly identify and articulate the problem that needs
to be solved.
2.Generate possible solutions: Come up with a list of potential solutions to
the problem.
3.Evaluate and select the best solution: Consider the pros and cons of each
solution, and choose the one that is most likely to be effective and feasible.
4.Implement the solution: Put the chosen solution into action, and monitor
its progress to ensure it is working as intended.
5.Reflect and learn: Reflect on the problem-solving process, and consider
what can be learned from the experience to apply to future problem-
solving efforts.
Problem-solving using Algorithmic
Thinking
• Define the problem: Clearly articulate the problem that needs to be
solved.
• Example: “I need to create a program that calculates the average score of the final
marks scored by students in the Principles of Programming at Ndejje University”
• Break the problem down: Divide the problem into smaller, more
manageable tasks.
• Example: “I will first create a mark entry functionality to input the marks, then
calculate the sum of the final marks in the provided list, and then I will calculate the
average of the marks.”
• Identify the data: Determine what data is needed to solve the problem,
and where it can be found.
• Example: “I will need a list of all the final scores, which I will get from the lecturer as
input.”
Problem-solving using Algorithmic Thinking
• Write pseudocode: Outline the steps needed to solve the problem
using plain English (or a similar language), without worrying about the
specific syntax of a programming language.
Problem-solving using Algorithmic Thinking…
• Outline all the other possible alternative pseudocodes.
• Consider the pros and cons of each pseudocode, and choose the one
that is most likely to be effective and feasible.
• Translate the selected pseudocode into a programming language.
• Test the code: Run the code to see if it produces the expected results.
• Example: “I will test the program by providing a list of final scores and output
the result.”
Problem-solving using Algorithmic Thinking…
• Debug: If the code does not work as expected, use debugging tools
and techniques to identify and fix any errors.
• Refactor the code: Once the code is working as intended, review it to
see if it can be made more efficient or more readable.
• Document the code: Include comments in the code to explain its
purpose and how it works.
Developing a Study Group Organization
Algorithm
• Design an algorithm that effectively organizes a study group,
considering various factors such as group size, member
availability, study preferences, and task allocation.
Tasks:
• Define the problem
• Identify inputs and outputs
• Develop the Algorithm: Create a step-by-step process to organize the
study group.
• Evaluate the Algorithm: Assess the efficiency and effectiveness of the
developed algorithm. Consider potential improvements / alternative
approaches.