
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















Developer,
Database Administrator, Networking Administrator, Penetration Tester
Mathematician, Cybersecurity Researcher
Algorithmics is the study of algorithms. It is the cornerstone of computer science.
computer science, and in all fairness, can be said to be relevant to most of
science, business, and technology”
Algorithm - Is a sequence of unambiguous instructions for solving a problem, i.e. for
obtaining a required output for any legitimate input in a finite amount of time.
Every algorithm development starts with a problem.
demonstrate a fact, result, or law.
Example:
Create an algorithm that accepts 1 integer input and 1Boolean output. The algorithm
determine whether the integer input is a odd or even number. Odd is represented by
false Boolean value while even is represented by true Boolean value. Condition: No
modulo operation
x = integer input y = Boolean output
For x >= 0 if x == 0 { y = true
end program
} else { y = false x = x - 2 if x < 0 {
end program
Example : Create an algorithm that get the GCD(Greatest common divisor) of two
positive integer inputs and produce an positive integer output.
Getting the GCD has many different algorithms to solve the problem:
**- Middle-school procedure
Middle-school procedure
Euclid’s Algorithm
Advantages of Euclid
Fundamentals of algorithmic problem solving
handle. This what is called an “ instance ”, means defining the set of inputs.
➢ The vast majority of algorithms in use today are still destined to be programmed
for a computer closely resembling the von Neumann machine —a computer
architecture outlined by the prominent.
➢ Hungarian-American mathematician John von Neumann (1903–1957), in
collaboration with A. Burks and H. Goldstine, in 1946.
There are a lots of techniques in designing algorithms. Most of our lesson will be
focusing on those techniques. Here are some techniques:
➢ Exhaustive Search and Brute Force
➢ Decrease and Conquer
➢ Divide and Conquer
➢ Transform and Conquer
➢ Space and Time Trade off
These are the two options that are most widely used nowadays for specifying
algorithms.
more concise and clear. And it is easy to implement to our programs. (Example
GCD algorithms, Euclids, Middle-school, consecutive integer)
has limitation, it is identified which inputs it takes.
Coding the Algorithm - The last fundamentals of algorithm problem solving
The Von Neumann Computer Architecture
It looks like the graphical representation of an algorithm
Random Access Memory (RAM) – is the essence of the architecture.
RAM - works as the central assumption is that instructions are executed one after
another one operation at a time.
Algorithms that execute one after another one is called sequential algorithms.
There’s also an algorithm that execute concurrent or parallel to one another. This is
what you called a parallel algorithms.
RAM follow the concept of instruction tables in which the algorithm is executed.
To demonstrate how algorithms are translated into assembly , or we can use
instruction table to represent in the Von Neumann Architecture.
0x
0x
0x
Commands (Right)
Memory Address (Left)
always starts at the
first memory address
one by one
memory address
and proceeds to the next
mov command – literally means move. In 0x00004, command means move 5 to
memory 0x00001.
command destination-memory, value
add command – one of the arithmetic commands, this command means adding the
value of two memory address or fix value.
Syntax is add memory-address1, memory-address
move the result to an empty memory, which is 0x00003.
end command – this indicates that the program has finish and stop the process.
Without the end command, the RAM/Program assumes that it will execute again by
returning to memory 0x
mov command – use to move data memory to one memory address to another
0x00004 mov 0x00001,
0x00005 mov 0x00001,
0x00006 add 0x00001,
0x
0x00007 mov 0x00003,
0x
0x00008 end
Closest-pair problem is finding the closest pair among n points.
Convex-hull problem is finding the smallest convex polygon that would include all
the points of a given set.
Numerical problems are problems that involve mathematical objects of continuous
nature: solving equations and systems of equations, computing definite integrals,
evaluating function and so on.
Fundamentals of data structures
items.
There are different kinds of data structure:
Linear Data Structure – is a data structure that the data are aligned in linear to the
memory.
There two most important linear data structure:
contiguously in computer memory and made accessible by specifying a value of
the array’s index.
learning programming.
containing two kinds of information: some data and one or more links called
pointers to other nodes of the linked list.
next memory address it follows.
There are two type of linked list: singly linked list and doubly linked list.
to the next element.
contains pointers to both its successor and its predecessor
Graphs
Informal Definition : a collection of points in the plane called “vertices” or “nodes,”
some of them connected by line segments called “edges” or “arcs.”
Formal Definition : a graph G=〈V,E〉is defined by a pair of two sets: a finite non
empty set V of items called vertices and a set E of pairs of these items called edges.
which uses physics concepts to solve computational problems. Which they say
can revolutionize all computing technologies
be represented as n.
Input’s size will greatly affects the space and time complexity of all algorithms.
Input size is the foundation of analysis of algorithms. Most algorithms depends on how
much space and time they consumed depending on the input.
Example of computational problems that affects the time and space complexity :
Problem: Summation of natural numbers which n is set as the maximum value.
If every add operation executes 10 seconds, how many seconds does it takes does this
function will take?
Case 1:
Let n = 5
p(n) = n + (n - 1) + (n - 2) + … + (n - n)
p(5) = 5 + 4 + 3 + 2 + 1 + 0
p(5) = 15
This takes 50 seconds to execute
milliseconds, etc… Because every computers have different time unit in
executing operations.
Example:
Two parts in the analysis framework:
First, we use the Input’s Size to determine how much space and time the algorithm will
consume.
Second, Operation Counting, we determined how many operations that the algorithm
will execute, since using time unit is not efficient!
Now lastly, the Order of Growth
Order of Growth - is determining the algorithm’s operation count as input goes
larger and larger until infinity. It is also a way of computer scientist in categorize where
the growth of algorithms grows.
Order of Growth : Basic asymptotic efficiency classes:
Algorithms running at logarithmic time
runs at when the algorithm total
operation count gets smaller by dividing
them to halves.
Example:
Binary Tree search algorithms
1 constant
log 𝑛 logarithmic
𝑛 linear
𝑛 log 𝑛 linearithmic
2
quadratic
3
cubic
𝑛
exponential
𝑛! factorial
o Second , for some important problems—e.g., sorting, searching, matrix
multiplication, string matching — the brute-force approach yields
reasonable algorithms of at least some practical value with no limitation on
instance size.
o Third , the expense of designing a more efficient algorithm may be
unjustifiable if only a few instances of a problem need to be solved and a
brute-force algorithm can solve those instances with acceptable speed.
o Fourth , even if too inefficient in general, a brute-force algorithm can still
be useful for solving small-size instances of a problem.
o Finally , a brute-force algorithm can serve an important theoretical or
educational purpose as a yardstick with which to judge more efficient
alternatives for solving a problem.
Selection Sort
with the first element, putting the smallest element in its final position in the
sorted list.
the last n − 1 elements and exchange it with the second element, putting the
second smallest element in its final position
each iteration and places that element at the beginning of the unsorted list.