Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
77 views10 pages

Understanding Time Complexity in Algorithms

Uploaded by

Gerlie Aguinod
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views10 pages

Understanding Time Complexity in Algorithms

Uploaded by

Gerlie Aguinod
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Algorithm Is a step by step process to solve a problem

describe how the running time or space


requirements of an algorithm increase relative to
Growth functions the size of its input

is a crucial concept in computer science that


helps us analyze and compare the performance
of algorithms. It provides a way to measure the
efficiency of algorithms, particularly in terms of
how their resource usage (time and space)
Big-O notation scales as the input size increases.
In ______ time complexity, the time taken grows
linearly with the input size. This is common in
algorithms that involve iterating through an array
or list once, such as searching for a specific
O(n) element.
______time complexity occurs when an
algorithm involves nested loops iterating over the
input. The time taken grows quadratically with
the input size. A classic example is bubble sort,
where each element is compared with every
O(n^2) other element in the array.
_______ time complexity is characteristic of
algorithms that divide the problem into halves
O(log n) repeatedly, such as binary search.
is used in computer science to describe the
asymptotic lower bound of an algorithm,
analyzing its best-case situation in terms of time
Big Omega complexity.
is a mathematical notation used in computer
science to describe the worst-case time
complexity of an algorithm or the worst-case
Big-o space complexity of a data structure.

combines the concepts of Big-O and Big Omega


by providing both upper and lower bounds for a
function. It effectively encapsulates a tighter
range of potential performance, offering a more
Big Theta notation precise estimate of algorithm efficiency.
measures how long an algorithm takes to
complete as the input size grows. It's crucial for
understanding how an algorithm's performance
Time Complexity scales with larger datasets.
____ time complexity is like accessing an item in
a grocery store by its number on a shelf. You can
grab it instantly without needing to look through
other items. It always takes the same amount of
time, no matter how many items are on the
Constant shelves.
____ time complexity is like finding a specific
book in a library. You start with the main index,
then keep narrowing down your search by
Logarithmic dividing the sections in half.
Counting all the people in a room is ________
time complexity. You need to check each person
individually, and the time increases proportionally
Linear to the number of people in the room.
____ time complexity is like multiplying two large
matrices. It involves checking every element in
both matrices, and the time grows exponentially
with the size of the matrices. It gets increasingly
Polynomial complex with larger inputs.
Trying every possible route to visit all cities in a
country is ________ time complexity. The
number of routes increases dramatically with the
number of cities, making this approach
Exponential impractical for large datasets.
Efficient algorithms like Merge Sort and Quick
Sort have a ______ time complexity. This means
the time increases faster than linear but slower
than exponential, making them practical for large
Linearithmic datasets.

_____ time complexity is where the time


increases as the square of the input size. This is
less efficient than algorithms with linearithmic
Quadratic time complexity, especially for larger datasets.
____ time complexity is the least efficient time
complexity, often impractical for even moderately
Factorial sized datasets.
measures the amount of memory an algorithm
needs to run. It's expressed using Big O notation,
just like time complexity. This includes the space
for input data and any auxiliary space the
Space Complexity algorithm uses.
In ____ space complexity, the memory required
grows proportionally to the input size. This
means if the input doubles, the space needed
Linear also doubles.
______ space complexity means the algorithm
uses a fixed amount of memory, regardless of
the input size. This is often seen in algorithms
Constant that don't create new data structures.
The space required by the algorithm that does
not depend on the input size, such as variables,
Fixed Part constants, and program size.
The space required by variables that depend on
the input size, such as dynamic memory
Variable Part allocation, stack space for recursion, etc.
Input size The amount of memory required to store the input data is a key c
Auxiliary Data Structures Any additional data structures created by the algorithm, such as a
The memory used by the function call stack,
which stores information about active function
Function Call Stack calls, is also part of the space complexity.
The space occupied by the actual code of the
Program Code algorithm
Any fixed constants used within the algorithm,
Constants such as fixed numbers or strings.
Basic variables like integers or floats that are
defined at the start and do not change based on
Simple Variable input size.
Arrays or objects that have a predetermined size
Fixed-sized Data Structures not influenced by the input.
Memory used for creating new data structures
like arrays, linked lists, or hash tables whose size
Dynamic Memory Allocation depends on the input.

Memory required to store information about


Recursion Call Stack active function calls during recursive algorithms.
Space used by temporary variables whose size
scales with the input, such as loop counters or
Temporary Variables pointers.
The ____ case scenario is when the algorithm
performs the minimum number of operations.
This is important for understanding how an
algorithm can perform under optimal conditions.
It helps to identify the most efficient way an
best algorithm can operate.
The _____ case scenario is when the algorithm
performs the maximum number of operations.
This is crucial for ensuring that an algorithm can
handle the largest input sizes efficiently. It helps
to understand the limits of an algorithm's
worst performance.
The _____ case scenario is a more realistic
scenario where the algorithm's performance is
averaged over all possible inputs. This is
essential for understanding the typical
performance of an algorithm. It provides a more
realistic view of how an algorithm will perform in
average practice.
is a technique used to analyze the average-case
performance of algorithms over a sequence of
operations. It helps determine the overall cost of
a series of operations, rather than focusing on
the worst-case scenario for each individual
Amortized analysis operation.
finds applications in various areas of computer
science, including data structures like dynamic
arrays, heaps, and hash tables. It helps optimize
algorithms used in data processing, sorting, and
Amortized analysis searching.
is particularly useful when analyzing algorithms
that involve trade-offs between time and space
complexity. It helps understand how the choice of
data structures and algorithms impacts the
Amortized analysis overall performance of a system.
plays a crucial role in computer science,
Number Theory particularly in algorithms and cryptography.
The ____ of two integers is the largest integer
that divides both of them without leaving a
GCD remainder.
are rectangular arrays of numbers that represent
data in a structured way. They are essential tools
in various fields like mathematics, physics, and
Matrices computer science.
Matrix addition is commutative, but multiplication
Commutativity is not.

Associativity Matrix addition and multiplication are associative.


Distributivity Matrix multiplication distributes over addition.

The ________ denoted by I, is a square matrix


Identity Matrix with ones on the diagonal and zeros elsewhere.
The ______ of a square matrix is a scalar value
that provides information about the matrix's
Determinant properties.
The ______ of a square matrix is another matrix
that, when multiplied by the original matrix,
Inverse results in the identity matrix.
A matrix with a determinant of zero is called a
Singular Matrix ________ and does not have an inverse.
________ are scalar values that represent the
Eigenvalues scaling
factor of an eigenvector.
______ are vectors that remain in the same
Eigenvectors direction after a linear transformation.
is used to represent a graph. The element A(ij)
indicates the presence or absence of an edge
between vertices i and j. For example, in an
undirected graph, a 1 in A(ij) indicates that vertex
Adjacency matrix i is connected to vertex j.
is a matrix where the elements are either 0 or 1.
These matrices are used in logic and digital
Boolean matrix circuits.

are a fundamental concept in mathematics with


numerous applications across various fields.
They provide a powerful tool for representing and
manipulating data, solving systems of equations,
Matrices and understanding linear transformations.
What is the result of multiplying a matrix by its
Identity Matrix inverse?
What is the space complexity of the recursive
O(n) Fibonacci algorithm without memoization?
Which best describes the worst-case time
O(n) complexity of a Linear Search algorithm?
In which of the following cases is amortized
Insertion in a dynamic array analysis commonly used?
Methods used to count the number of ways an
Counting Techniques event can occur.
If one event can happen in several ways and
another event can also happen in several ways,
the total number of outcomes is the product of
Fundamental Principle of Counting the two.
The product of all positive numbers up to a given
Factorial number.
is the branch of mathematics dealing with
symbols and the rules for manipulating those
Algebra symbols
Permutation | Permutations An arrangement of objects in a specific order
refer to the different ways to choose a set of
Selection | Selections objects where the order doesn’t matter.

is a concept that connects elements of one set to


elements of another, or even within the same set.
This connection is defined by an ordered pair (a,
Relation b), where a is from set A and b is from set B.
is a collection of ordered pairs of elements from
the same set that describes how thois a
collection of ordered pairs of elements
from the same set that describes how those
elements are
relation on a set connected or related.
a relation on a set A is an _______________ if it
Equivalence Relation is reflexive, symmetric, and transitive.
is a pictorial representation of any data in an
organised manner. The graph shows the
graph relationship between variable quantities.
introduced the concept of graph theory. He was a
Leonhard Euler very famous Swiss mathematician.
is the study of points and lines. In Mathematics, it
is a sub-field that deals with the study of graphs.
It is a pictorial representation that represents the
Graph Theory Mathematical truth.
is a graph made up of a set of vertices connected
by edges, in which the edges have a direction
Directed Graph associated with them.
is defined as a graph where the set of nodes are
connected together, in which all the edges are
bidirectional. Sometimes, this type of graph is
Undirected Graph known as the undirected network.
Null Graph A graph that does not have edges.
A graph that is undirected and does not have any
Simple Graph loops or multiple edges.
A graph with multiple edges between the same
Multigraph set of vertices. It has loops formed.
A graph where any two vertices are connected
Connected Graph by a path.
A graph where any two vertices or nodes are
Disconnected Graph disconnected by a path.
Cycle Graph A graph that completes a cycle.
When each pair of vertices are connected by an
Complete Graph edge then such graph is called a complete graph

When no two edges of a graph intersect and are


all the vertices and edges are drawn in a single
Planar Graph plane, then such a graph is called a planar graph
The starting point of the network is known as the
root _____.
When the same types of nodes are connected to
one another, then the graph is known as an
assortative _____ graph,
Cycle Graph is said to be a graph that has a single cycle.
When all the pairs of nodes are connected by a
Complete Graph single edge it forms a _______________.
A graph is said to be in _____ when each pair of
vertices or nodes are connected in the same
symmetry direction or in the reverse direction.
When a graph has a single graph, it is a
Path Graph __________.
A _____ in a graph is the connection between
undirected networks which are having only one
Tree path between any two vertices.
A tree in a graph was introduced by British
Arthur Cayley mathematician __________ in 1857.
A ________ in a graph is mentioned to be the
degree number of edges connected to a vertex.
Cycle is a closed path in a graph that forms a loop.
is a versatile algorithm used to find the shortest
paths from a single source vertex to all other
Bellman-Ford algorithm vertices in a weighted graph.
is a greedy algorithm used to find a minimum
spanning tree (MST) of a weighted, undirected
graph. It works by iteratively merging
components of the graph until a single
Boruvka's algorithm component, the MST, remains.
is a discrete structure that represents hierarchical
relationships between individual elements or
Tree nodes.
Tree is a connected acyclic undirected graph.
A tree with N number of vertices contains _____
N - 1 | N-1 number of edges
The ______ of a tree is a vertex with minimal
center eccentricity.
The ______ of a vertex in a tree is the maximum
distance between the vertex and any other vertex
eccentricity of the tree.
If a tree has more than one center, it is called a
Bi-central Tree | Bi-centered Tree ___________.
is a tree where the vertices of which are
Labeled Tree assigned unique numbers from 1 to n.
is a tree the vertices of which are not assigned
Unlabeled Tree any numbers.
is a connected acyclic graph with a special node
that is called the root of the tree and every edge
Rooted Tree directly or indirectly originates from the root
In a binary tree, what is the maximum number of
2 children a vertex can have?
Recognizes regular languages, which are
defined by regular expressions or regular
Finite Automata grammars

Recognizes context-free languages, which allow


Pushdown Automata hierarchical structures like balanced parentheses

Recognizes recursively enumerable languages,


Turing Machines which are the most general class of languages
Recognizing grammatical structures in human
Natural Language Processing languages.
is a mathematical abstraction used in computer
science to define a set of strings, or sequences
of symbols, that are used to create explicit
Formal Language instructions for a computer system
is a set of strings of symbols from a finite
alphabet, defined by rules like regular
Formal Language expressions or context-free grammars.
is the study of the syntactic aspects of formal
languages, or their internal structural patterns. It
provides theoretical aspects of computer science
and helps to determine infinite languages in finite
Formal Language Theory ways.
is a mathematical model used to recognize
patterns in strings of symbols. It can be thought
of as a machine that processes an input string
and determines whether it belongs to a certain
Finite State Automata language (a set of strings).
In a ____________, the output depends only on
the current state. Each state has a specific output
associated with it, regardless of the input symbol
Moore Machine that causes the transition
What are the two types of Finite Automata with
Moore Machine & Mealy Machine output?
In a ____________, the output depends on both
the current state and the input symbol. The
output is generated during the transition between
states, based on the current state and the input
Mealy Machine symbol
Deterministic Finite Automata & Non-
Deterministic Finite Automata & Epsilon Non- What are the three types of Finite Automata
Deterministic Finite Automata without Output?
__________________are finite state machines
that accept or reject strings of characters by
parsing them through a sequence that is uniquely
Deterministic Finite Automata determined by each string.
the machine can move to any combination of the
states in the machine. Comes from the word,
“non-determinism” , which means that the
machine moves cannot be determined. The next
Non-Deterministic Finite Automata state may be chosen at random.
is a nondeterministic finite automaton (NFA) that
has some transitions labeled with the empty
symbol, or epsilon (ε). This allows the automaton
to move to a new state without consuming or
Epsilon Non-Deterministic Finite Automata processing an input symbol
is a formal language that can be defined by a
regular expression, finite automaton, or state
machine. It is a subset of all strings, and is a key
Regular Language topic in computability theory
A language is recursive(decidable) if it is the
setof strings accepted by some Turing Machine
that halts on
Recursive Language every input.

A language is recursively enumerable if is the set


Recursive Enumerable Language of strings accepted by some Turing Machine.
is an Unrestricted grammar in which allthe
Context-Sensitive Grammar productions areofform
the syntax or structure of a formal language can
Context-Free Grammar be described using ______________
ed to store the input data is a key component of space complexity.
created by the algorithm, such as arrays, linked lists, or hash tables, contribute to the space complexity.

You might also like