IT101-1L (1-3 Lessons) :( Flashcards
step-by-step procedure or set of rules for solving a specific problem.
Algorithm
How can be algorithms be expressed? (4)
Natural Language
Pseudocode
Flowchart
Actual Programming code
Algorithms must have a ‘precisely’ defined set of instructions that leave no ambiguity or room for interpretation.
Well-defined:
: Algorithms must terminate after a finite number of steps. They should not enter an infinite loop or continue indefinitely.
Finite
Algorithms take zero or more inputs, which are the initial data or values on which they operate to produce the desired output.
Input:
Algorithms produce one or more outputs, which are the results or solutions obtained after executing the instructions.
Output:
meaning that for a given input, they will always produce the same output.
Deterministic:
It is the foundation of computer science and plays a crucial role in problem-solving and software development.
Algorithm
Algorithms should be practical and efficient, capable of solving the problem within a reasonable amount of time and resources.
Feasible:
Each step should be clear and unambiguous.
Well-defined
There should be no randomness or uncertainty involved in their execution.
Deterministic
_____________ involves careful planning, analysis, and consideration of various factors.
Designing effective algorithms
Clarify the requirements, constraints, and expected outcomes. Break down the problem into smaller subproblems, if necessary.
Understand the Problem
Identify the input required to solve the problem. Determine the format, data types, and possible range of input values. Similarly, define the expected output and its format.
Determine the Input and Output
Break the problem into smaller subproblems, solve them independently, and combine the solutions to obtain the final result.
Divide and Conquer
Make locally optimal choices at each step, hoping to reach the global optimum.
Greedy:
is a well-defined set of instructions that precisely describes how to perform a particular task or solve a problem.
algorithm
: Break the problem into overlapping subproblems, solve them once, and store the results to avoid redundant computations.
Dynamic Programming
Systematically explore all possible solutions by trying out different choices and undoing them if they do not lead to a valid solution.
Backtracking:
Enumerate all possible solutions in a systematic manner, pruning branches that are guaranteed to be suboptimal.
Branch and Bound:
Use randomness or probability to find a solution or improve the efficiency of the algorithm.
Randomized:
_________ provide a systematic approach to breaking down complex tasks into smaller, more manageable steps.
Algorithms
What are the algorithmic paradigms? (6)
Divide and Conquer
Greedy
Dynamic Programming
Backtracking
Branch and Bound
Randomized
Select an ____________ or approach that suits the problem at hand
Choose an Algorithmic Paradigm
Create a high-level description of the algorithm using pseudocode, a language-independent representation of the solution
Develop a High-Level Algorithm
Focus on the logic and steps required to solve the problem, without getting into the specifics of programming syntax.
Develop a High-Level Algorithm
Review and refine the algorithm for correctness, efficiency, and readability
Refine the Algorithm
Optimize it by reducing unnecessary steps, improving time or space complexity, and eliminating redundancy.
Refine the Algorithm
Consider edge cases and handle exceptions appropriately.
Refine the Algorithm
Translate the refined algorithm into your programming language of choice
Implement the Algorithm
Write the code, following the syntax and conventions of the language.
Implement the Algorithm
Make sure to incorporate the necessary input/output operations and any auxiliary data structures required.
Implement the Algorithm
Thoroughly test the implemented algorithm using different inputs, including typical cases, boundary values, and exceptional scenarios.
Test and Debug
Verify that the algorithm produces the expected output and handles various scenarios correctly. Debug any issues or errors encountered during testing.
Test and Debug
Analyze the algorithm’s performance in terms of time complexity and space complexity.
Analyze and Optimize
Identify potential bottlenecks and inefficiencies. Consider alternative approaches or optimizations to improve the algorithm’s efficiency, if necessary.
Analyze and Optimize
how its execution time grows as the input size increases
time complexity
how much memory it requires
space complexity
are the building blocks of problem-solving and software development.
Algorithms
They provide a systematic approach to breaking down complex problems into manageable steps, ensuring consistent and predictable results
Algorithms
What is the purpose of testing and debugging an implemented algorithm?
To verify the correctness and handle exceptions
What does it mean for an algorithm to be feasible
It takes into account various constraints and requirements
Steps for Designing Algorithms for Problem-Solving 8
Understand the Problem
Determine the Input and Output
Choose an Algorithmic Paradigm
Develop a High-Level Algorithm
Refine the Algorithm
Implement the Algorithm
Test and Debug
Analyze and Optimize
are graphical representations of a process or algorithm that use various symbols and arrows to depict the sequence of steps.
Flowcharts
Flowcharts visually represent the steps and flow of a process, making it easier to understand and analyze.
Process Visualization:
Flowcharts provide a common visual language that can be easily understood by different stakeholders involved in a process, facilitating effective communication.
Communication:
Flowcharts help identify bottlenecks, inefficiencies, and areas of improvement within a process, enabling process optimization.
Process Analysis:
Flowcharts serve as a useful tool for analyzing and solving problems by breaking them down into manageable steps and visualizing the decision-making process.
Problem-Solving:
Flowcharts serve as documentation for processes, algorithms, and systems, making it easier to maintain and update them over time.
Documentation:
start or end point of a flowchart
Terminator Symbol:
represents an action or operation within the flowchart
Process symbol
represent a condition or decision point in a flowchart
Decision Symbol
input or output of data in the flowchart
input/output symbol
used to connect different parts of a flowchart
Connector Symbol
Flow of control or direction whithin the flowchart
Arrow
_______________is a high-level, structured language used to describe algorithms in a human-readable and language-independent manner.
Pseudocode
Pseudocode is not tied to any specific programming language. It can be easily understood and translated into any programming language, making it a universal language for algorithm design.
Language Independence:
Pseudocode uses a simplified syntax and natural language constructs, making it easier to read, understand, and communicate algorithmic concepts
Simplicity and Readability:
Pseudocode allows algorithm designers to express algorithmic ideas and concepts without the constraints of a specific programming language.
Flexibility:
Pseudocode can be easily understood by both technical and non-technical stakeholders, enabling effective collaboration and communication during the algorithm design process.
Accessibility:
Assigning a value to a variable is typically represented using an arrow (←) or an equal sign (=).
Assignment:
Pseudocode represents input and output operations using appropriate keywords, such as input and output.
Input and Output: