IT101-1L (1-3 Lessons) :( Flashcards

1
Q

step-by-step procedure or set of rules for solving a specific problem.

A

Algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How can be algorithms be expressed? (4)

A

Natural Language
Pseudocode
Flowchart
Actual Programming code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Algorithms must have a ‘precisely’ defined set of instructions that leave no ambiguity or room for interpretation.

A

Well-defined:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

: Algorithms must terminate after a finite number of steps. They should not enter an infinite loop or continue indefinitely.

A

Finite

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Algorithms take zero or more inputs, which are the initial data or values on which they operate to produce the desired output.

A

Input:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Algorithms produce one or more outputs, which are the results or solutions obtained after executing the instructions.

A

Output:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

meaning that for a given input, they will always produce the same output.

A

Deterministic:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

It is the foundation of computer science and plays a crucial role in problem-solving and software development.

A

Algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Algorithms should be practical and efficient, capable of solving the problem within a reasonable amount of time and resources.

A

Feasible:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Each step should be clear and unambiguous.

A

Well-defined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

There should be no randomness or uncertainty involved in their execution.

A

Deterministic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

_____________ involves careful planning, analysis, and consideration of various factors.

A

Designing effective algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Clarify the requirements, constraints, and expected outcomes. Break down the problem into smaller subproblems, if necessary.

A

Understand the Problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

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.

A

Determine the Input and Output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Break the problem into smaller subproblems, solve them independently, and combine the solutions to obtain the final result.

A

Divide and Conquer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Make locally optimal choices at each step, hoping to reach the global optimum.

A

Greedy:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

is a well-defined set of instructions that precisely describes how to perform a particular task or solve a problem.

A

algorithm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

: Break the problem into overlapping subproblems, solve them once, and store the results to avoid redundant computations.

A

Dynamic Programming

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Systematically explore all possible solutions by trying out different choices and undoing them if they do not lead to a valid solution.

A

Backtracking:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Enumerate all possible solutions in a systematic manner, pruning branches that are guaranteed to be suboptimal.

A

Branch and Bound:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Use randomness or probability to find a solution or improve the efficiency of the algorithm.

A

Randomized:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

_________ provide a systematic approach to breaking down complex tasks into smaller, more manageable steps.

A

Algorithms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are the algorithmic paradigms? (6)

A

Divide and Conquer
Greedy
Dynamic Programming
Backtracking
Branch and Bound
Randomized

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Select an ____________ or approach that suits the problem at hand

A

Choose an Algorithmic Paradigm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Create a high-level description of the algorithm using pseudocode, a language-independent representation of the solution
Develop a High-Level Algorithm
26
Focus on the logic and steps required to solve the problem, without getting into the specifics of programming syntax.
Develop a High-Level Algorithm
27
Review and refine the algorithm for correctness, efficiency, and readability
Refine the Algorithm
28
Optimize it by reducing unnecessary steps, improving time or space complexity, and eliminating redundancy.
Refine the Algorithm
29
Consider edge cases and handle exceptions appropriately.
Refine the Algorithm
30
Translate the refined algorithm into your programming language of choice
Implement the Algorithm
31
Write the code, following the syntax and conventions of the language.
Implement the Algorithm
32
Make sure to incorporate the necessary input/output operations and any auxiliary data structures required.
Implement the Algorithm
33
Thoroughly test the implemented algorithm using different inputs, including typical cases, boundary values, and exceptional scenarios.
Test and Debug
34
Verify that the algorithm produces the expected output and handles various scenarios correctly. Debug any issues or errors encountered during testing.
Test and Debug
35
Analyze the algorithm's performance in terms of time complexity and space complexity.
Analyze and Optimize
36
Identify potential bottlenecks and inefficiencies. Consider alternative approaches or optimizations to improve the algorithm's efficiency, if necessary.
Analyze and Optimize
37
how its execution time grows as the input size increases
time complexity
38
how much memory it requires
space complexity
39
are the building blocks of problem-solving and software development.
Algorithms
40
They provide a systematic approach to breaking down complex problems into manageable steps, ensuring consistent and predictable results
Algorithms
41
What is the purpose of testing and debugging an implemented algorithm?
To verify the correctness and handle exceptions
42
What does it mean for an algorithm to be feasible
it produces consistent and predictable results
43
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
44
are graphical representations of a process or algorithm that use various symbols and arrows to depict the sequence of steps.
Flowcharts
45
Flowcharts visually represent the steps and flow of a process, making it easier to understand and analyze.
Process Visualization:
46
Flowcharts provide a common visual language that can be easily understood by different stakeholders involved in a process, facilitating effective communication.
Communication:
47
Flowcharts help identify bottlenecks, inefficiencies, and areas of improvement within a process, enabling process optimization.
Process Analysis:
48
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:
49
Flowcharts serve as documentation for processes, algorithms, and systems, making it easier to maintain and update them over time.
Documentation:
50
start or end point of a flowchart
Terminator Symbol:
51
represents an action or operation within the flowchart
Process symbol
52
represent a condition or decision point in a flowchart
Decision Symbol
53
input or output of data in the flowchart
input/output symbol
54
used to connect different parts of a flowchart
Connector Symbol
55
Flow of control or direction whithin the flowchart
Arrow
56
_______________is a high-level, structured language used to describe algorithms in a human-readable and language-independent manner.
Pseudocode
57
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:
58
Pseudocode uses a simplified syntax and natural language constructs, making it easier to read, understand, and communicate algorithmic concepts
Simplicity and Readability:
59
Pseudocode allows algorithm designers to express algorithmic ideas and concepts without the constraints of a specific programming language.
Flexibility:
60
Pseudocode can be easily understood by both technical and non-technical stakeholders, enabling effective collaboration and communication during the algorithm design process.
Accessibility:
61
Assigning a value to a variable is typically represented using an arrow (←) or an equal sign (=).
Assignment:
62
Pseudocode represents input and output operations using appropriate keywords, such as input and output.
Input and Output:
63
Pseudocode includes various control structures to represent decision-making and looping.
Control Structures:
64
allows the definition and calling of functions or procedures to encapsulate reusable code blocks.
Pseudocode
65
in pseudocode are used to provide additional explanations, clarifications, or to annotate the code
Comments
66
The flowchart begins with a "Start" symbol, representing the start of the algorithm, and ends with an "End" symbol, indicating the completion of the algorithm.
Start/End:
67
Use rectangles or rectangles with rounded corners to represent process steps.
Process:
68
Use diamonds to represent decision points or conditions. The flow branches based on the outcome of the decision. T
Decision:
69
Use arrows to connect symbols and indicate the flow of control between steps.
Connector/Arrow:
70
: Use parallelograms to represent input or output operations.
Input/Output
71
is a versatile and widely used programming language known for its simplicity, readability, and flexibility.
Python
72
Who developed pyhton
Guido van Rossum
73
_______ is a general-purpose, high-level programming language that supports multiple programming paradigms, including procedural, object-oriented, and functional programming.
Python
74
Python's simple and clear syntax allows programmers to express their ideas with less code compared to other languages.
Easy to read and write
75
Python abstracts away low-level details, making it easier to focus on problem-solving rather than managing system resources.
High level language
76
allows variables to hold different data types during the program's execution, making Python code concise and adaptable.
Dynamically typed
77
Python code is highly portable and can be executed on different platforms, including Windows, macOS, Linux, and more, without modification.
Portability and Cross-platform Compatibility
78
are used to include external libraries and functionality into the Python program.
Module imports
79
are placed at the top level of the program and are accessible throughout the entire program.
Global variable declarations
80
contain the implementation of custom functions used in the program.
Function definitions
81
play a crucial role in Python programming as they provide essential functionality and organization to the code.
Modules
82
provides mathematical functions, including trigonometric, logarithmic, exponential, and rounding functions.
math module
83
offers functions to generate random numbers, shuffle sequences, and select random elements.
random module
84
provides functions to interact with the operating system, allowing you to perform tasks like file and directory operations, environment variable access, and process management.
os module
85
provides classes and functions for working with dates, times, and intervals.
datetime module
86
provides functions for encoding and decoding data in JSON format. Common functions include json.dumps(), json.loads(), and json.dump().
json module
87
are fundamental guidelines that govern the structure and composition of programs in the Python programming language
Syntax rules
88
are terminated with a newline,
statements
89
is used to define blocks of code.
indentation
90
are defined using the def keyword, followed by the function name and parameters.
Functions
91
a wide range of operators for arithmetic, assignment, comparison, logical operations, and more.
Operators
92
_______ statements, such as if, for, while, and try...except, are used to control the execution flow of a program.
Control flow
93
significantly enhance code readability in Python.
Proper formatting and indentation
94
occur when the code violates the rules of the Python programming language.
Syntax errors
95
, also known as exceptions, occur when the code is syntactically correct, but something goes wrong during program execution.
Runtime errors
96
occur when the code is syntactically and semantically correct, but it does not produce the intended output or behavior.
Logical errors
97
Debugging is a systematic process of identifying and fixing errors in the code
Debugging
98
Inserting print statements at strategic points in the code can help trace the program's execution and identify potential errors.
Print Statements:
99
Utilizing a debugger allows you to step through the code line by line, inspect variables, and analyze the program's behavior during runtime.
Debugger:
100
: Engaging in code review with peers or experienced programmers can provide fresh perspectives and uncover errors that might have been overlooked
Code Review
101
Creating comprehensive ___________ and providing a range of inputs to the program can help identify errors and verify the correctness of the code.
Test Cases and Test Inputs
102
When faced with complex issues, divide the problem into smaller parts and test each part individually.
Divide and Conquer
103
are named storage locations that hold values during program execution.
Variables
104
are fixed values that do not change during program execution.
Constants
105
are blocks of code that perform specific tasks.
Functions
106
They provide additional context, explanations, and instructions within the code, aiding both developers and future maintainers.
Comments
107
Comments act as a form of communication within the code, helping developers understand the purpose, functionality, and logic of different sections of code.
Enhancing Code Readability and Understanding
108
Comments also foster collaboration among team members by facilitating code sharing and maintenance.
Facilitating Collaboration and Maintenance
109
During the debugging process, comments can be invaluable in identifying and isolating problematic code sections.
Assisting Debugging and Troubleshooting
110
comments are used to add explanations or comments on a single line.
Single-line
111
also known as block comments, allow for longer explanations or comments spanning multiple lines.
Multi-line comments,
112
in programming define the kind of data that variables can hold.
Data types
113
The ___________ is used to represent integers, which are whole numbers without a fractional part.
int data type
114
type is used to represent floating-point numbers, which are numbers with decimal points.
The float data
115
is used to represent complex numbers in the form of real + imag * j, where j represents the square root of -1.
The complex data type
116
is used to represent strings, which are sequences of characters.
The str data type
117
is used to represent Boolean values, which can be either True or False.
The bool data type
118
is used to represent ordered collections of items.
The list data type
119
is used to represent ordered collections of items, similar to lists.
The tuple data type
120
is used to represent unordered collections of unique items.
The set data type
121
is used to represent dictionaries, which store key-value pairs.
The dict data type
122
represents the absence of a value
The None data type
123
in Python are similar to other programming languages and can be integers or floating-point numbers.
Numeric constants
124
String constants in Python are defined using single or double quotes.
String constants
125
also known as keywords, are predefined words in a programming language that have special meanings and are reserved for specific purposes
Reserved words,
126
Represents the Boolean value for false.
False:
127
: Represents a special object that signifies the absence of a value.
None
128
: Represents the Boolean value for true.
True
129
Creates an alias for a module or import.
as:
130
: Tests if a condition is true; otherwise, raises an exception.
assert
131
Terminates the execution of a loop.
break:
132
: Defines a class, which is a blueprint for creating objects.
class
133
Skips the current iteration of a loop and proceeds to the next iteration.
continue:
134
: Defines a function.
def
135
Deletes a variable or an element from a list or dictionary.
del:
136
Short for "else if," defines an alternative branch in an if statement.
elif:
137
Defines the default branch in an if statement.
else:
138
Catches an exception in a try-except block.
except:
139
Defines a block of code to be executed regardless of whether there was an exception.
finally:
140
Defines a loop that iterates over a sequence.
for:
141
Imports specific attributes or submodules from a module.
from:
142
Declares a global variable inside a function.
global:
143
Evaluates a condition and executes a block of code if the condition is true.
if:
144
Imports a module.
import:
145
Checks if a value is present in a sequence.
in:
146
Checks if two variables refer to the same object.
is:
147
Creates an anonymous (inline) function.
lambda:
148
: Declares a non-local variable inside a nested function.
nonlocal
149
: Performs a logical NOT operation.
not
150
Performs a logical OR operation.
or:
151
Represents a null operation (a placeholder for future code).
pass:
152
Raises an exception.
raise:
153
: Exits a function and returns a value
return
154
Defines a block of code with potential exceptions.
try:
155
: Defines a loop that repeats a set of statements while a condition is true.
while
156
Creates a context manager for resource management.
with:
157
Yields a value from a generator function.
yield:
158