[go: up one dir, main page]

0% found this document useful (0 votes)
48 views28 pages

Algortihms

The document provides information about algorithms including their definition, history, and common types. It defines an algorithm as a step-by-step procedure or formula for solving a problem or completing a task. The earliest known algorithm was developed by the Persian mathematician Al-Khwarizmi in the 9th century. Common algorithm types discussed include searching algorithms like linear and binary search, and sorting algorithms like bubble, selection, bucket, and merge sort.

Uploaded by

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

Algortihms

The document provides information about algorithms including their definition, history, and common types. It defines an algorithm as a step-by-step procedure or formula for solving a problem or completing a task. The earliest known algorithm was developed by the Persian mathematician Al-Khwarizmi in the 9th century. Common algorithm types discussed include searching algorithms like linear and binary search, and sorting algorithms like bubble, selection, bucket, and merge sort.

Uploaded by

Jenny A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

ALGORITH

MS
Introduction
The word algorithm comes from the name of the 9th century
Persian and Muslim mathematician Abu Abdullah Muhammad ibn
Musa Al-Khwarizmi, he was mathematician, astronomer and
geographer during the Islamic prophet era.

 A scholar in the House of Wisdom in Baghdad. Also he is often


considered one of the fathers of algebra.
Algorithm in
for solvingEnglish
An algorithm (pronounced AL-go-rith-um) is a procedure or formula
a problem, based on conducting a sequence of specified
actions.

 A recipe is a good example of an algorithm because it tells you what


you need to do step by step.
Algorithm in
English
Example: Steps in Making Pancakes:
1. Mix flour, baking powder, salt, and sugar.
2. Mix milk, eggs, and oil.
3. Mix dry ingredients with wet ingredients.
4. Pre-heat the pan or skillet.
5. Add oil to pan.
6. Pour the batter into the pan.
7. Flip the pancakes when the bubbles burst.
Algorithm in
English
Example: Going Home Algorithm
Algorithm 1 Algorithm 2
1. Walking 1. Take the bus
2. Leave Classroom 2. Go to bus are
3. Turn right out of school 3. Get in the right bus
building
4. Walk 2.1 miles 4. Go to the house
5. Turn right on street
6. Go to the 4th house
Computer

Programming
It is a process of creating computer programs which perform a
desired function. It may be a program that solves a
problem,
computingperforms task automation, or anything that
of a series of instructions written in programming
executio involves
n
language.
It is a profession that has been around for a long time.
Mathematician Ada Lovelace , born 1815, was considered the first
computer programmer when she wrote an algorithm for Charles
Babbage’s Analytical Engines.
Algorithm in
Programming
Algorithm – is a step by step procedure, which defines a set of
instructions to be executed in certain order to get the desired
output.

In computer science, this word refers to a special method useable


by a computer for solution of a problem. The statement of the
problem specifies in general terms the desired input/output
relationship.
Algorithms ca be written in:
Pseudocode - (pronounced SOO-doh-kohd) is a detailed yet
readable description of what a computer program or algorithm
must do.
 Flowcharts
Some of the Well-
Known
equations;
Algorithms
Euler method and Backward Euler method for solving differential

 Gauss-Legendre algorithm and Borwein’s algorithm for the


computation
of pi ( );
Long division, Restoring division, Non-restoring division, and Sweeney-
Robertson-Tocher algorithm for computing quotients;
 Levinson method, Thomas method, Gaussian elimination for solving
systems of linear equations;
Round-robin, Fair-share and , Earliest deadline first for operating system
job scheduling.
Hamming distance and Levenshtein edit distance for computing string
similarity.
Mostly used
Algorithms
 Searching Algorithms

 Sorting Algorithms
Searching
Algorithms
 A search algorithm is the step-by-step procedure used to
locate specific data among a collection of data.

It is considered a fundamental procedure in computing. In


computer science, when searching for data, the difference
between a fast application and a slower one often lies in the
use of the proper search algorithm.
Types of Search
Algorithms
1. Linear Search – In computer science, a linear search or sequential
search is a method for finding an element within a list.
It sequentially checks each element of the list until a match is
found or the whole list has been searched.
Types of Search
Algorithms
2. Binary Search – In computer science, binary search, also known as
half-interval search, logarithmic search, or binary chop, is a search
algorithm that finds the position of a target value within a sorted array.
Binary search compares the target value to the middle element of the
array.
Exampl
e
Exampl
e
Exampl
e
Exampl
e
Sorting
Algorithms
In programming, sorting simply means arranging a list of
items in a particular order, most commonly, alphabetically
or numerically, and either in ascending or descending order.
Sorting makes it easier and faster to locate items in a list.
Sorting
Algorithms
Louise Dana

Michaela Denise

Joshua Sorting Fran


Algorithm
(ascending) Joaquin
Denise

Dana Joshua

Fran Louise
Sorting a list of name
Joaquin in ascending order Michaela
Sorting
Algorithms
92 93

47 92

29 Sorting 84
Algorithm
(descending)
53 53

84 48

48 47
Sorting a list of
93 numbers in 29
descending order
Types Sorting
Algorithm
Bubble Sort – is simplest sorting algorithm that works by
repeatedly swapping the adjacent elements if they are in wrong
order.
Types Sorting
Algorithm
Selection Sort – It repeatedly passes through the list of items to be
sorted, and selects the lowest value ( or highest value in the case of a
descending sort)
Initially, the sorted part is empty, and the unsorted part is the entire list.
Descending to
Ascending order
Types Sorting
Algorithm
Bucket Sort – It is a sorting algorithm which makes use of “buckets” to
sort a list.
It is a comparison sort algorithm that operates on elements by dividing
them into different buckets and then sorting these buckets individually.
Each bucket is sorted individually using a separate sorting algorithm or
by applying the bucket sort algorithm recursively.
In the example above:
1. Create a bucket that have ranges (0 to 9, 10 to 19 etc.)
2. Recurse to the list and identify what bucket a specific item needs
to go into.
Types Sorting
Algorithm
Merge Sort – is another divide and conquer algorithm similar to the
bucket sort algorithm.
The idea of breaking down a list into several sub-lists until each
sub list consists of a single element and merging those sub lists in a
manner that results into a sorted list.

It closely follows the Divide & Conquer Paradigm.


Conceptually, it works as follows:
◦ Divide: Divide the unsorted list into two sub lists of about half the
size.
◦ Conquer: Sort each of the two sub lists recursively until we have list
sizes of length 1, in which case the list items are returned.
◦ Combine: Join the two sorted sub lists back into one sorted list.

You might also like