SlideShare a Scribd company logo
1 of 50
Program By :- Eman El-ma’asarawi 2/24/2011 1
What is Program? How to make program? How to think about the program? Steps for making a good project. 2/24/2011 2
2/24/2011 3
DS Algorithm Program +  = 2/24/2011 4
 list of instruction to achieve specific task. Program I/P instruction Processing instruction O/P instruction 2/24/2011 5
Programming Toolboxes H/W S/W Os Compiler  Text editor  Idea ware Algorithm DS Programming Methodologies Structure Design Oop  S/W Concepts Information hiding Data encapsulation Data abstraction 2/24/2011 6
Algorithm DS Methodologies Application (text editor) Compiler  OS HW 2/24/2011 7
        DS (Data Structure) Data :- factual information  Structure :- Arrangement or relationship of elements as particles Data structure :-A means of storing a collection of data 2/24/2011 8
DS cont… A data structure can be viewed as consisting of a set of algorithms for performing operations on the data it stores. 2/24/2011 9
Variable:- 			data storage location that has a value that can change during program execution.  Constant:- 		fixed value that can’t change. 2/24/2011 10
Applications of Data Structure DS Linear Non-Linear Sequential Linked Linked queues Graphs Tree Linked stacks linked lists queue array stack 2/24/2011 11
1-Array 2-Linked List 3-Stack 4-Queue 5-Tree 2/24/2011 12
1-Array  Is a data structure where all elements are stored in contiguous memory n 2 1 0 Individual elements Array  2/24/2011 13
Random access Fixed size Less efficient used on data stored in array Array properties Array size Element size 1-in bytes 2-the number of element Data type of array 2/24/2011 14
Exambel 0 1 2 3 4 5 6 7   1      2     34     56      2     78      0     10 2/24/2011 15
2-linked list Is a data structure in which the first element is  (head) stored on its own Data List head / Dummy Node Null 2/24/2011 16
Linked list properties The size not fixed grow/shrink The extra space is needed to store the pointer of each element  More time Implement linked list use array but not efficient Complex to code and manage 2/24/2011 17
Appending Node 		add Node to the end of the list. Traversing 		check the linked list. Inserting Node 		add Node in the middle of a list. Deleting Node from memory 			 Modified links Destroy Operation on linked list 2/24/2011 18
Which is fast array or linked list? Why? 2/24/2011 19
Is a data structure consisting of data nodes connected to each other with pointers. Each node connected to 2 or more other nodes. 2/24/2011 20 			5-Trees
The order of the tree:- 		is the max number of nodes to which any single node connected.  binary tree:- 		is the simplest tree is of order 2. 	each child have two pointers. Root node:- 		the topmost node in the tree.  leaf node:- 	node with no children. 2/24/2011 21 Tree properties
Data right left Data right left Data right left 2/24/2011 22
Create binary tree Inserting Node Traversing the tree recursion Searching the tree Deleting the tree 2/24/2011 23 Binary search tree op…
Logical sequence of steps describe complete solution to solve problem in finite amount of time May involve alternation, iteration or recursion More than one algorithm possible for the same task Algorithms 2/24/2011 24
Sorting 				Searching -Insertion sort 			-linear search -Merge sort			-Binary search	 -Heap sort -Quick sort 2/24/2011 25 Algorithmes
What resources are required to accomplish the task  How one algorithm compares with other algorithms  How much time or space is required  Measured in terms of common basic operations Efficiency of Algorithms 2/24/2011 26
Worst-case: (usually)            T(n) = maximum time of algorithm on any input of size n. Average-case: (sometimes) T(n) = expected time of algorithm over all inputs of size n. Need assumption of statistical distribution of inputs. Best-case: (bogus)              Cheat with a slow algorithm that works fast on some input. 2/24/2011 27 Kinds of analyses
Running time:  On a particular input, it is the number of primitive operations (steps) executed.  One line may take a different amount of time than another, but each execution of line i takes the same amount of time c . Running time of the algorithm is 	Ʃ (cost of statement)*(number of times statement is executed) 2/24/2011 28
How efficiency varies with the size of the task  E.g. if the size of the task increases linearly, do the efficiency measures increase linearly, quadratically, exponentially,...?  Expressed in terms of standard functions of n Complexity 2/24/2011 29
notations Big o Big Ɵ Big Ω 	F(n)=g(n) C1g(n)<=f(n)<=c2g(n) F(n)<=g(n) F(n)>=g(n) Data shape Ex - insertion sort best case Data method Ex – insertion sort worst case 2/24/2011 30
PseudoCodeconventions Indentation indicates block structure. While, for, repeat , if , then, and else. ▹indicates comment. indicates assignment. Variables are local by default. Array elements accessed as in A[i]. 2/24/2011 31
Calculate x^n, where n is an integer greater than 0. Algorithm 1. Set r = 1 2. Set i = 1 3. Repeat 	3.1 If i=n then terminate loop 	3.2 Multiply r by x 	3.3 Add 1 to i 4. Exit with result r ExampleSimple Power Algorithm 2/24/2011 32
O(n) - the algorithm requires n multiplications. Time complexity 2/24/2011 33
Formulate a Concise Specification of the Problem Design a high-level strategy for a solution Refine steps 1 and 2 if necessary Complete the details of the design Implement in the chosen language How to Approach Recursive Algorithms 2/24/2011 34
Calculate x^n, where n is an integer greater than 0.  Recursive Algorithm 1. If n=0 then  1.1 set r = 1  2. Else  2.1 set p = n/2 (dropping any remainder)  2.2 set r = (xp)2  2.3 if n is odd then  2.3.1 multiply r by x  3. Exit with result r Recursive Power Algorithm 2/24/2011 35
static int power (int x, int n) { 	int r; 	if (n == 0) 		r = 1; 	else { 		r = power(x,n/2); 		r = r*r; 		if (n%2 != 0) 			r *= x; 	} 	return r; } 2/24/2011 36 implementation
O(log n) - the algorithm requires approximately log   n multiplications. 2 Time complexity 2/24/2011 37
2/24/2011 38
Quiz Towers of Hanoi 1 2 3 2/24/2011 39
1 2 3 2/24/2011 40
1 2 3 2/24/2011 41
1 2 3 2/24/2011 42
1 2 3 2/24/2011 43
1 2 3 2/24/2011 44
1 2 3 2/24/2011 45
1 2 3 2/24/2011 46
Solution' ≡ shortest path  Recursive Solution: 1. Identify biggest discrepancy (=disk N)  2. If moveable to goal peg Then move       Else 3.   Subgoal: set-up (N−1)-disk tower on non-goal peg.  4. Go to 1.  ... 2/24/2011 47
2/24/2011 48
SDLC (s/w Development life cycle) Design Problem analysis Maintenance  Testing Requirement definitions Implementation  Using program  Delivery 2/24/2011 49
The End 2/24/2011 50

More Related Content

What's hot

Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Anything but simple Mathematica
Anything but simple MathematicaAnything but simple Mathematica
Anything but simple MathematicaSergeiPronkevich
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)Memo Love
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrixSaidur Rahman
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlabrishiteta
 
AITC: White Paper on Distributed Level Of Permission Hierarchy
AITC: White Paper on Distributed Level Of Permission HierarchyAITC: White Paper on Distributed Level Of Permission Hierarchy
AITC: White Paper on Distributed Level Of Permission HierarchyRajesh Kumar
 
Forelasning4
Forelasning4Forelasning4
Forelasning4Memo Love
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueGhaffar Khan
 
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with DataProgramming Logic and Design: Working with Data
Programming Logic and Design: Working with DataNicole Ryan
 
Array sorting
Array sortingArray sorting
Array sortingALI RAZA
 
Introduction to MATLAB 1
Introduction to MATLAB 1Introduction to MATLAB 1
Introduction to MATLAB 1Mohamed Gafar
 
C Programming : Pointers and Arrays, Pointers and Strings
C Programming : Pointers and Arrays, Pointers and StringsC Programming : Pointers and Arrays, Pointers and Strings
C Programming : Pointers and Arrays, Pointers and StringsSelvaraj Seerangan
 

What's hot (17)

Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Anything but simple Mathematica
Anything but simple MathematicaAnything but simple Mathematica
Anything but simple Mathematica
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
 
02. the linked lists (1)
02. the linked lists (1)02. the linked lists (1)
02. the linked lists (1)
 
Basic matlab and matrix
Basic matlab and matrixBasic matlab and matrix
Basic matlab and matrix
 
Storage struct
Storage structStorage struct
Storage struct
 
Basic operators in matlab
Basic operators in matlabBasic operators in matlab
Basic operators in matlab
 
AITC: White Paper on Distributed Level Of Permission Hierarchy
AITC: White Paper on Distributed Level Of Permission HierarchyAITC: White Paper on Distributed Level Of Permission Hierarchy
AITC: White Paper on Distributed Level Of Permission Hierarchy
 
Project Report
Project ReportProject Report
Project Report
 
Data structure
Data structureData structure
Data structure
 
Forelasning4
Forelasning4Forelasning4
Forelasning4
 
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
 
Introductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, QueueIntroductiont To Aray,Tree,Stack, Queue
Introductiont To Aray,Tree,Stack, Queue
 
Programming Logic and Design: Working with Data
Programming Logic and Design: Working with DataProgramming Logic and Design: Working with Data
Programming Logic and Design: Working with Data
 
Array sorting
Array sortingArray sorting
Array sorting
 
Introduction to MATLAB 1
Introduction to MATLAB 1Introduction to MATLAB 1
Introduction to MATLAB 1
 
C Programming : Pointers and Arrays, Pointers and Strings
C Programming : Pointers and Arrays, Pointers and StringsC Programming : Pointers and Arrays, Pointers and Strings
C Programming : Pointers and Arrays, Pointers and Strings
 

Viewers also liked (20)

Bibliografia geral
Bibliografia geralBibliografia geral
Bibliografia geral
 
Liquid Day - Microservicios y contenedores
Liquid Day - Microservicios y contenedoresLiquid Day - Microservicios y contenedores
Liquid Day - Microservicios y contenedores
 
Atividade de sistemas operacionais
Atividade de sistemas operacionaisAtividade de sistemas operacionais
Atividade de sistemas operacionais
 
Prácticas tema agricultura
Prácticas tema agriculturaPrácticas tema agricultura
Prácticas tema agricultura
 
Usa el correo electrónico
Usa el correo electrónicoUsa el correo electrónico
Usa el correo electrónico
 
Botas fujiwara
Botas fujiwaraBotas fujiwara
Botas fujiwara
 
Competitive winning strategy
Competitive winning strategyCompetitive winning strategy
Competitive winning strategy
 
Homai Vyarawala
Homai VyarawalaHomai Vyarawala
Homai Vyarawala
 
Hay Esquistosomiasis
Hay EsquistosomiasisHay Esquistosomiasis
Hay Esquistosomiasis
 
60 Hz Flygt N-Pump Series Brochure
60 Hz Flygt N-Pump Series Brochure60 Hz Flygt N-Pump Series Brochure
60 Hz Flygt N-Pump Series Brochure
 
Sintesis informativa 07 05 2015
Sintesis informativa 07 05 2015Sintesis informativa 07 05 2015
Sintesis informativa 07 05 2015
 
Cisa cpe-spanish
Cisa cpe-spanishCisa cpe-spanish
Cisa cpe-spanish
 
Dil Nasil öğRenilir
Dil Nasil öğRenilirDil Nasil öğRenilir
Dil Nasil öğRenilir
 
Informe de lectura. met
Informe de lectura. metInforme de lectura. met
Informe de lectura. met
 
Gmail.com
Gmail.comGmail.com
Gmail.com
 
Info aula 00 - conceito de internet
Info   aula 00 - conceito de internetInfo   aula 00 - conceito de internet
Info aula 00 - conceito de internet
 
La TecnologíA Mmm
La  TecnologíA MmmLa  TecnologíA Mmm
La TecnologíA Mmm
 
Lección 10 problemas dinámicos
Lección 10 problemas dinámicosLección 10 problemas dinámicos
Lección 10 problemas dinámicos
 
P1 s3 d1 baja
P1 s3 d1 bajaP1 s3 d1 baja
P1 s3 d1 baja
 
Sistemas biológicos
Sistemas  biológicosSistemas  biológicos
Sistemas biológicos
 

Similar to Algorithms

Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxPJS KUMAR
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...bekidea
 
CS3114_09212011.ppt
CS3114_09212011.pptCS3114_09212011.ppt
CS3114_09212011.pptArumugam90
 
Deep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlowDeep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlowOswald Campesato
 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesAmirthaVarshini80
 
Introduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptxIntroduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptxline24arts
 
Towards an Incremental Schema-level Index for Distributed Linked Open Data G...
Towards an Incremental Schema-level Index  for Distributed Linked Open Data G...Towards an Incremental Schema-level Index  for Distributed Linked Open Data G...
Towards an Incremental Schema-level Index for Distributed Linked Open Data G...Till Blume
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm AnalysisMary Margarat
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialTo Sum It Up
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...DrkhanchanaR
 
Workshop nwav 47 - LVS - Tool for Quantitative Data Analysis
Workshop nwav 47 - LVS - Tool for Quantitative Data AnalysisWorkshop nwav 47 - LVS - Tool for Quantitative Data Analysis
Workshop nwav 47 - LVS - Tool for Quantitative Data AnalysisOlga Scrivner
 

Similar to Algorithms (20)

Introduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptxIntroduction to data structures and complexity.pptx
Introduction to data structures and complexity.pptx
 
Data structures
Data structuresData structures
Data structures
 
Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...Data Structure and Algorithm chapter two, This material is for Data Structure...
Data Structure and Algorithm chapter two, This material is for Data Structure...
 
Chapter 2 ds
Chapter 2 dsChapter 2 ds
Chapter 2 ds
 
Scala and Deep Learning
Scala and Deep LearningScala and Deep Learning
Scala and Deep Learning
 
Lec1
Lec1Lec1
Lec1
 
CS3114_09212011.ppt
CS3114_09212011.pptCS3114_09212011.ppt
CS3114_09212011.ppt
 
Deep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlowDeep Learning: R with Keras and TensorFlow
Deep Learning: R with Keras and TensorFlow
 
C++ and Deep Learning
C++ and Deep LearningC++ and Deep Learning
C++ and Deep Learning
 
Data Structures unit I Introduction - data types
Data Structures unit I Introduction - data typesData Structures unit I Introduction - data types
Data Structures unit I Introduction - data types
 
Introduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptxIntroduction to Data structure and algorithm.pptx
Introduction to Data structure and algorithm.pptx
 
Towards an Incremental Schema-level Index for Distributed Linked Open Data G...
Towards an Incremental Schema-level Index  for Distributed Linked Open Data G...Towards an Incremental Schema-level Index  for Distributed Linked Open Data G...
Towards an Incremental Schema-level Index for Distributed Linked Open Data G...
 
Data Structures and Algorithm Analysis
Data Structures  and  Algorithm AnalysisData Structures  and  Algorithm Analysis
Data Structures and Algorithm Analysis
 
cyber_systems.pdf
cyber_systems.pdfcyber_systems.pdf
cyber_systems.pdf
 
Lect1.pptx
Lect1.pptxLect1.pptx
Lect1.pptx
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
 
DATA STRUCTURE.pdf
DATA STRUCTURE.pdfDATA STRUCTURE.pdf
DATA STRUCTURE.pdf
 
DATA STRUCTURE
DATA STRUCTUREDATA STRUCTURE
DATA STRUCTURE
 
Workshop nwav 47 - LVS - Tool for Quantitative Data Analysis
Workshop nwav 47 - LVS - Tool for Quantitative Data AnalysisWorkshop nwav 47 - LVS - Tool for Quantitative Data Analysis
Workshop nwav 47 - LVS - Tool for Quantitative Data Analysis
 

More from DevMix

Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
Devmix algorithm
Devmix algorithmDevmix algorithm
Devmix algorithmDevMix
 
Select your career
Select your careerSelect your career
Select your careerDevMix
 
Devmix algorithm
Devmix algorithmDevmix algorithm
Devmix algorithmDevMix
 
Framework prototype
Framework prototypeFramework prototype
Framework prototypeDevMix
 
New in html5
New in html5New in html5
New in html5DevMix
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBaseDevMix
 
Intro to windows app
Intro to windows appIntro to windows app
Intro to windows appDevMix
 
OOP in C#
OOP in C#OOP in C#
OOP in C#DevMix
 
Logos samples
Logos samplesLogos samples
Logos samplesDevMix
 
C sharp fundamentals Part I
C sharp fundamentals Part IC sharp fundamentals Part I
C sharp fundamentals Part IDevMix
 
Python
PythonPython
PythonDevMix
 
Making a presentation
Making a presentationMaking a presentation
Making a presentationDevMix
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud ComputingDevMix
 

More from DevMix (15)

Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
Devmix algorithm
Devmix algorithmDevmix algorithm
Devmix algorithm
 
Select your career
Select your careerSelect your career
Select your career
 
Devmix algorithm
Devmix algorithmDevmix algorithm
Devmix algorithm
 
Framework prototype
Framework prototypeFramework prototype
Framework prototype
 
New in html5
New in html5New in html5
New in html5
 
Intro To DataBase
Intro To DataBaseIntro To DataBase
Intro To DataBase
 
Intro to windows app
Intro to windows appIntro to windows app
Intro to windows app
 
OOP in C#
OOP in C#OOP in C#
OOP in C#
 
Logos samples
Logos samplesLogos samples
Logos samples
 
C sharp fundamentals Part I
C sharp fundamentals Part IC sharp fundamentals Part I
C sharp fundamentals Part I
 
Python
PythonPython
Python
 
Making a presentation
Making a presentationMaking a presentation
Making a presentation
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 

Recently uploaded

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 

Algorithms

  • 1. Program By :- Eman El-ma’asarawi 2/24/2011 1
  • 2. What is Program? How to make program? How to think about the program? Steps for making a good project. 2/24/2011 2
  • 4. DS Algorithm Program + = 2/24/2011 4
  • 5. list of instruction to achieve specific task. Program I/P instruction Processing instruction O/P instruction 2/24/2011 5
  • 6. Programming Toolboxes H/W S/W Os Compiler Text editor Idea ware Algorithm DS Programming Methodologies Structure Design Oop S/W Concepts Information hiding Data encapsulation Data abstraction 2/24/2011 6
  • 7. Algorithm DS Methodologies Application (text editor) Compiler OS HW 2/24/2011 7
  • 8. DS (Data Structure) Data :- factual information Structure :- Arrangement or relationship of elements as particles Data structure :-A means of storing a collection of data 2/24/2011 8
  • 9. DS cont… A data structure can be viewed as consisting of a set of algorithms for performing operations on the data it stores. 2/24/2011 9
  • 10. Variable:- data storage location that has a value that can change during program execution. Constant:- fixed value that can’t change. 2/24/2011 10
  • 11. Applications of Data Structure DS Linear Non-Linear Sequential Linked Linked queues Graphs Tree Linked stacks linked lists queue array stack 2/24/2011 11
  • 12. 1-Array 2-Linked List 3-Stack 4-Queue 5-Tree 2/24/2011 12
  • 13. 1-Array Is a data structure where all elements are stored in contiguous memory n 2 1 0 Individual elements Array 2/24/2011 13
  • 14. Random access Fixed size Less efficient used on data stored in array Array properties Array size Element size 1-in bytes 2-the number of element Data type of array 2/24/2011 14
  • 15. Exambel 0 1 2 3 4 5 6 7 1 2 34 56 2 78 0 10 2/24/2011 15
  • 16. 2-linked list Is a data structure in which the first element is (head) stored on its own Data List head / Dummy Node Null 2/24/2011 16
  • 17. Linked list properties The size not fixed grow/shrink The extra space is needed to store the pointer of each element More time Implement linked list use array but not efficient Complex to code and manage 2/24/2011 17
  • 18. Appending Node add Node to the end of the list. Traversing check the linked list. Inserting Node add Node in the middle of a list. Deleting Node from memory Modified links Destroy Operation on linked list 2/24/2011 18
  • 19. Which is fast array or linked list? Why? 2/24/2011 19
  • 20. Is a data structure consisting of data nodes connected to each other with pointers. Each node connected to 2 or more other nodes. 2/24/2011 20 5-Trees
  • 21. The order of the tree:- is the max number of nodes to which any single node connected. binary tree:- is the simplest tree is of order 2. each child have two pointers. Root node:- the topmost node in the tree. leaf node:- node with no children. 2/24/2011 21 Tree properties
  • 22. Data right left Data right left Data right left 2/24/2011 22
  • 23. Create binary tree Inserting Node Traversing the tree recursion Searching the tree Deleting the tree 2/24/2011 23 Binary search tree op…
  • 24. Logical sequence of steps describe complete solution to solve problem in finite amount of time May involve alternation, iteration or recursion More than one algorithm possible for the same task Algorithms 2/24/2011 24
  • 25. Sorting Searching -Insertion sort -linear search -Merge sort -Binary search -Heap sort -Quick sort 2/24/2011 25 Algorithmes
  • 26. What resources are required to accomplish the task How one algorithm compares with other algorithms How much time or space is required Measured in terms of common basic operations Efficiency of Algorithms 2/24/2011 26
  • 27. Worst-case: (usually) T(n) = maximum time of algorithm on any input of size n. Average-case: (sometimes) T(n) = expected time of algorithm over all inputs of size n. Need assumption of statistical distribution of inputs. Best-case: (bogus) Cheat with a slow algorithm that works fast on some input. 2/24/2011 27 Kinds of analyses
  • 28. Running time: On a particular input, it is the number of primitive operations (steps) executed. One line may take a different amount of time than another, but each execution of line i takes the same amount of time c . Running time of the algorithm is Ʃ (cost of statement)*(number of times statement is executed) 2/24/2011 28
  • 29. How efficiency varies with the size of the task E.g. if the size of the task increases linearly, do the efficiency measures increase linearly, quadratically, exponentially,...? Expressed in terms of standard functions of n Complexity 2/24/2011 29
  • 30. notations Big o Big Ɵ Big Ω F(n)=g(n) C1g(n)<=f(n)<=c2g(n) F(n)<=g(n) F(n)>=g(n) Data shape Ex - insertion sort best case Data method Ex – insertion sort worst case 2/24/2011 30
  • 31. PseudoCodeconventions Indentation indicates block structure. While, for, repeat , if , then, and else. ▹indicates comment. indicates assignment. Variables are local by default. Array elements accessed as in A[i]. 2/24/2011 31
  • 32. Calculate x^n, where n is an integer greater than 0. Algorithm 1. Set r = 1 2. Set i = 1 3. Repeat 3.1 If i=n then terminate loop 3.2 Multiply r by x 3.3 Add 1 to i 4. Exit with result r ExampleSimple Power Algorithm 2/24/2011 32
  • 33. O(n) - the algorithm requires n multiplications. Time complexity 2/24/2011 33
  • 34. Formulate a Concise Specification of the Problem Design a high-level strategy for a solution Refine steps 1 and 2 if necessary Complete the details of the design Implement in the chosen language How to Approach Recursive Algorithms 2/24/2011 34
  • 35. Calculate x^n, where n is an integer greater than 0. Recursive Algorithm 1. If n=0 then 1.1 set r = 1 2. Else 2.1 set p = n/2 (dropping any remainder) 2.2 set r = (xp)2 2.3 if n is odd then 2.3.1 multiply r by x 3. Exit with result r Recursive Power Algorithm 2/24/2011 35
  • 36. static int power (int x, int n) { int r; if (n == 0) r = 1; else { r = power(x,n/2); r = r*r; if (n%2 != 0) r *= x; } return r; } 2/24/2011 36 implementation
  • 37. O(log n) - the algorithm requires approximately log n multiplications. 2 Time complexity 2/24/2011 37
  • 39. Quiz Towers of Hanoi 1 2 3 2/24/2011 39
  • 40. 1 2 3 2/24/2011 40
  • 41. 1 2 3 2/24/2011 41
  • 42. 1 2 3 2/24/2011 42
  • 43. 1 2 3 2/24/2011 43
  • 44. 1 2 3 2/24/2011 44
  • 45. 1 2 3 2/24/2011 45
  • 46. 1 2 3 2/24/2011 46
  • 47. Solution' ≡ shortest path Recursive Solution: 1. Identify biggest discrepancy (=disk N) 2. If moveable to goal peg Then move Else 3. Subgoal: set-up (N−1)-disk tower on non-goal peg. 4. Go to 1. ... 2/24/2011 47
  • 49. SDLC (s/w Development life cycle) Design Problem analysis Maintenance Testing Requirement definitions Implementation Using program Delivery 2/24/2011 49