SlideShare una empresa de Scribd logo
1 de 23
Algorithm & Data Structures CSC-112
                           Spring 2012
My Profile
   Name:
       Syed Muhammad Raza

   Education:
       MSc Wireless Communication
           LTH – Sweden , 2007-2009

       BS Computer Information Sciences
           PIEAS – Pakistan , 2002-2006

   Contact Information:
       Email: (Preferred mean of communication)
           smraza@comsats.edu.pk

        **(In subject of your email mention your semester and name, otherwise it will not be
            entertained)
Rules

        Take it seriously & you will prosper
          Take it lightly & you will doom
Course Overview
   Fundamentals of Algorithms
   Review of Programming
   Sorting and Searching
   Stacks
   Queues, Priority Queues and Circular Queues
   Linked List
   Trees
   Hashing
   Graphs
    and much more …..
Text Book


             No Text Book
                   &
            Every Text Book
Recommended Books
   Schaum Programming with Cplusplus by Seymour Lipschutz

   Sams Teach Yourself Data Structures and Algorithms in 24 Hours, Lafore Robert

   Data structures and algorithms, Alfred V. Aho, John E. Hopcroft.

   Standish, Thomas A., Data Structures, Algorithms and Software Principles in C,
    Addison-Wesley 1995, ISBN: 0-201-59118-9

   Data Structures & Algorithm Analysis in C++, Weiss Mark Allen
Marks Distribution

  Lab   25% of 100 Marks (Semester Project & Presentation)
               Theory 75% of 100 Marks

                  Sessional 1 = 10 Marks
                  Sessional 2 = 15 Marks
                  Final Paper = 50 Marks
                  Assignment = 15 Marks
             Quiz        = 10 Marks (Surprise)
               Total          = 100 Marks
Lets see what you got!
Quiz 1
Marks:2
Time: 15mins

   Explain Abstract Data Types?
   Explain difference between abstraction and
    encapsulation?
   If you have to write a code for swapping int values,
    arrays will be appropriate solution or 2D arrays?
Algorithm
Problem Solving

 Problem solving is the process of transforming the
 description of a problem into the solution of that problem
 by using our knowledge of the problem domain and by
 relying on our ability to select and use appropriate
 problem-solving strategies, techniques, and tools.
Algorithms
   An Algorithm is a step by step solution to a problem

   Why bother writing an algorithm
       For your own use in the future - Don't have to rethink the
        problem.

       So others can solve the problem, even if they know very
        little about the principles behind how the solution was
        derived.
Examples of Algorithms
   Washing machine instructions

   Instructions for a ready-to-assemble piece of furniture

   A Classic: GCD - Greatest Common Divisor - The
    Euclidean Algorithm
Washing Machine Instructions
   Separate clothes into white clothes and colored clothes.

   For white clothes:
       Set water temperature knob to HOT.

       Place white laundry in tub.

   For colored clothes:
       Set water temperature knob to COLD

       Place colored laundry in tub.

   Add 1 cup of powdered laundry detergent to the tub.

   Close lid and press the start button.
Observations
   There are a finite number of steps.

   We are capable of doing each of the instructions.

   When we have followed all of the steps, the washing
    machine will wash the clothes and then will stop.

   Are all of the clothes clean ?

   Do we want the washing machine to run until all of the
    clothes are clean ?
Refinement of the Definition
   Our old definition:
       An algorithm is a step by step solution to a problem.

   Adding our observations:
       An algorithm is a finite set of executable instructions that directs a
        terminating activity.
Instructions for a Ready-to-Assemble Furniture
   "Align the marks on side A with the grooves on Part F “

   Why are these instructions typically so hard to follow ?
       Lack of proper tools - instructions are not executable

       Which side is A ? A & B look alike. Both line up with Part F -

        Ambiguous instructions.
Final Definition


 An algorithm is a finite set of unambiguous, executable
 instructions that directs a terminating activity.
History of Algorithms
   The study of algorithms began as a subject in mathematics.

   The search for algorithms was a significant activity of early
    mathematicians.

   Goal: To find a single set of instructions that could be used to solve
    any problem of a particular type.
GCD- Euclidean Algorithm
   Assign M and N the value of the larger and the value of the smaller
    of the two positive integer input values, respectively.

   Divide M by N and call the remainder R.

   If R is not 0, then assign M the value of N, assign N the value of R
    and return to step 2, otherwise the greatest common divisor is the
    value currently assigned to N.
Finding GCD of 24 & 9
                                     MNR
                                     24 9 6
                                      963
                                      630
                       So 3 is the GCD of 24 and 9.


   Do we need to know the theory that Euclid used to come up with this
    algorithm in order to use it ?

   What intelligence is required to find the GCD using this algorithm ?
Idea Behind the Algorithms
   Once an algorithm behind a task has been discovered
       Don't need to understand the principles.

       Task is reduced to following the instructions.

       Intelligence is "encoded into the algorithm"
Algorithm Representation
   Syntax and Semantics
       Syntax refers to the representation itself.

       Semantics refers to the concept represented.

Más contenido relacionado

La actualidad más candente

Data structures using C
Data structures using CData structures using C
Data structures using CPdr Patnaik
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)jehan1987
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsGanesh Solanke
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsRajendran
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms Krishna Chaytaniah
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computingjayavignesh86
 
Data Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsData Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsAbdullah Al-hazmy
 
Introduction to Data Structures & Algorithms
Introduction to Data Structures & AlgorithmsIntroduction to Data Structures & Algorithms
Introduction to Data Structures & AlgorithmsAfaq Mansoor Khan
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureVrushali Dhanokar
 
Programming in python
Programming in pythonProgramming in python
Programming in pythonIvan Rojas
 
Algorithm and Data Structures - Basic of IT Problem Solving
Algorithm and Data Structures - Basic of IT Problem SolvingAlgorithm and Data Structures - Basic of IT Problem Solving
Algorithm and Data Structures - Basic of IT Problem Solvingcoolpie
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithmTrupti Agrawal
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchAmrinder Arora
 

La actualidad más candente (20)

Data structures using C
Data structures using CData structures using C
Data structures using C
 
Design & Analysis Of Algorithm
Design & Analysis Of AlgorithmDesign & Analysis Of Algorithm
Design & Analysis Of Algorithm
 
Algorithm analysis (All in one)
Algorithm analysis (All in one)Algorithm analysis (All in one)
Algorithm analysis (All in one)
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
Basic terminologies & asymptotic notations
Basic terminologies & asymptotic notationsBasic terminologies & asymptotic notations
Basic terminologies & asymptotic notations
 
Design and analysis of computer algorithms
Design and analysis of computer algorithmsDesign and analysis of computer algorithms
Design and analysis of computer algorithms
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
Data Structures- Part2 analysis tools
Data Structures- Part2 analysis toolsData Structures- Part2 analysis tools
Data Structures- Part2 analysis tools
 
Daa notes 2
Daa notes 2Daa notes 2
Daa notes 2
 
Chapter 10 ds
Chapter 10 dsChapter 10 ds
Chapter 10 ds
 
Data structure
Data structureData structure
Data structure
 
Introduction to Data Structures & Algorithms
Introduction to Data Structures & AlgorithmsIntroduction to Data Structures & Algorithms
Introduction to Data Structures & Algorithms
 
Algorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structureAlgorithm analysis in fundamentals of data structure
Algorithm analysis in fundamentals of data structure
 
Chapter 7 ds
Chapter 7 dsChapter 7 ds
Chapter 7 ds
 
Programming in python
Programming in pythonProgramming in python
Programming in python
 
Algorithm and Data Structures - Basic of IT Problem Solving
Algorithm and Data Structures - Basic of IT Problem SolvingAlgorithm and Data Structures - Basic of IT Problem Solving
Algorithm and Data Structures - Basic of IT Problem Solving
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Data structure and algorithm
Data structure and algorithmData structure and algorithm
Data structure and algorithm
 
Graph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First SearchGraph Traversal Algorithms - Breadth First Search
Graph Traversal Algorithms - Breadth First Search
 

Similar a Algorithm & data structures lec1

Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1s_raza
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 introchidabdu
 
Kk20503 1 introduction
Kk20503 1 introductionKk20503 1 introduction
Kk20503 1 introductionLow Ying Hao
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Traian Rebedea
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdfGOWTHAMR721887
 
Design and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdfDesign and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdfHarshNagda5
 
Notion of an algorithm
Notion of an algorithmNotion of an algorithm
Notion of an algorithmNisha Soms
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1chidabdu
 
QULITIES OF A GOOD ALGORITHM
QULITIES OF A GOOD ALGORITHMQULITIES OF A GOOD ALGORITHM
QULITIES OF A GOOD ALGORITHMabdullahi419
 
01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptxaimeejc
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - IntroductionNeeldhara Misra
 
01 intro to algorithm--updated 2015
01 intro to algorithm--updated 201501 intro to algorithm--updated 2015
01 intro to algorithm--updated 2015Hira Gul
 
CubeIT Tech - Algorithms
CubeIT Tech - AlgorithmsCubeIT Tech - Algorithms
CubeIT Tech - AlgorithmsKirill Suslov
 
03 algorithm properties
03 algorithm properties03 algorithm properties
03 algorithm propertiesLincoln School
 
CS8451 DAA Unit-I.pptx
CS8451 DAA Unit-I.pptxCS8451 DAA Unit-I.pptx
CS8451 DAA Unit-I.pptxBolliniNivas
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptSourabhPal46
 

Similar a Algorithm & data structures lec1 (20)

Algorithm & data structures lec1
Algorithm & data structures lec1Algorithm & data structures lec1
Algorithm & data structures lec1
 
Sienna 1 intro
Sienna 1 introSienna 1 intro
Sienna 1 intro
 
Kk20503 1 introduction
Kk20503 1 introductionKk20503 1 introduction
Kk20503 1 introduction
 
Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2Algorithm Design and Complexity - Course 1&2
Algorithm Design and Complexity - Course 1&2
 
19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf19IS402_LP1_LM_22-23.pdf
19IS402_LP1_LM_22-23.pdf
 
Design and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdfDesign and Analysis Algorithms.pdf
Design and Analysis Algorithms.pdf
 
Notion of an algorithm
Notion of an algorithmNotion of an algorithm
Notion of an algorithm
 
Algorithm chapter 1
Algorithm chapter 1Algorithm chapter 1
Algorithm chapter 1
 
QULITIES OF A GOOD ALGORITHM
QULITIES OF A GOOD ALGORITHMQULITIES OF A GOOD ALGORITHM
QULITIES OF A GOOD ALGORITHM
 
chapter 1
chapter 1chapter 1
chapter 1
 
01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx01 - Introduction to Algorithms.pptx
01 - Introduction to Algorithms.pptx
 
00 - 30 Dec - Introduction
00 - 30 Dec - Introduction00 - 30 Dec - Introduction
00 - 30 Dec - Introduction
 
01 intro to algorithm--updated 2015
01 intro to algorithm--updated 201501 intro to algorithm--updated 2015
01 intro to algorithm--updated 2015
 
CubeIT Tech - Algorithms
CubeIT Tech - AlgorithmsCubeIT Tech - Algorithms
CubeIT Tech - Algorithms
 
DAA UNIT 3
DAA UNIT 3DAA UNIT 3
DAA UNIT 3
 
LR2. Summary Day 2
LR2. Summary Day 2LR2. Summary Day 2
LR2. Summary Day 2
 
l01-intro (3).ppt
l01-intro (3).pptl01-intro (3).ppt
l01-intro (3).ppt
 
03 algorithm properties
03 algorithm properties03 algorithm properties
03 algorithm properties
 
CS8451 DAA Unit-I.pptx
CS8451 DAA Unit-I.pptxCS8451 DAA Unit-I.pptx
CS8451 DAA Unit-I.pptx
 
lec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.pptlec_4_data_structures_and_algorithm_analysis.ppt
lec_4_data_structures_and_algorithm_analysis.ppt
 

Más de Abdul Khan

Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assemblyAbdul Khan
 
Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Abdul Khan
 
Lec 03 ia32 architecture
Lec 03  ia32 architectureLec 03  ia32 architecture
Lec 03 ia32 architectureAbdul Khan
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2Abdul Khan
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1Abdul Khan
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic conceptsAbdul Khan
 
war on terror
 war on terror war on terror
war on terrorAbdul Khan
 

Más de Abdul Khan (8)

Lec 04 intro assembly
Lec 04 intro assemblyLec 04 intro assembly
Lec 04 intro assembly
 
Algorithm & data structures lec4&5
Algorithm & data structures lec4&5Algorithm & data structures lec4&5
Algorithm & data structures lec4&5
 
Lec 03 ia32 architecture
Lec 03  ia32 architectureLec 03  ia32 architecture
Lec 03 ia32 architecture
 
Lec 02 data representation part 2
Lec 02 data representation part 2Lec 02 data representation part 2
Lec 02 data representation part 2
 
Lec 02 data representation part 1
Lec 02 data representation part 1Lec 02 data representation part 1
Lec 02 data representation part 1
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
war on terror
 war on terror war on terror
war on terror
 
Xhtml
XhtmlXhtml
Xhtml
 

Último

Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 

Último (20)

Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 

Algorithm & data structures lec1

  • 1. Algorithm & Data Structures CSC-112 Spring 2012
  • 2. My Profile  Name:  Syed Muhammad Raza  Education:  MSc Wireless Communication  LTH – Sweden , 2007-2009  BS Computer Information Sciences  PIEAS – Pakistan , 2002-2006  Contact Information:  Email: (Preferred mean of communication)  smraza@comsats.edu.pk **(In subject of your email mention your semester and name, otherwise it will not be entertained)
  • 3. Rules Take it seriously & you will prosper Take it lightly & you will doom
  • 4. Course Overview  Fundamentals of Algorithms  Review of Programming  Sorting and Searching  Stacks  Queues, Priority Queues and Circular Queues  Linked List  Trees  Hashing  Graphs and much more …..
  • 5. Text Book No Text Book & Every Text Book
  • 6. Recommended Books  Schaum Programming with Cplusplus by Seymour Lipschutz  Sams Teach Yourself Data Structures and Algorithms in 24 Hours, Lafore Robert  Data structures and algorithms, Alfred V. Aho, John E. Hopcroft.  Standish, Thomas A., Data Structures, Algorithms and Software Principles in C, Addison-Wesley 1995, ISBN: 0-201-59118-9  Data Structures & Algorithm Analysis in C++, Weiss Mark Allen
  • 7. Marks Distribution Lab 25% of 100 Marks (Semester Project & Presentation) Theory 75% of 100 Marks Sessional 1 = 10 Marks Sessional 2 = 15 Marks Final Paper = 50 Marks Assignment = 15 Marks Quiz = 10 Marks (Surprise) Total = 100 Marks
  • 8. Lets see what you got!
  • 9. Quiz 1 Marks:2 Time: 15mins  Explain Abstract Data Types?  Explain difference between abstraction and encapsulation?  If you have to write a code for swapping int values, arrays will be appropriate solution or 2D arrays?
  • 11. Problem Solving Problem solving is the process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and by relying on our ability to select and use appropriate problem-solving strategies, techniques, and tools.
  • 12. Algorithms  An Algorithm is a step by step solution to a problem  Why bother writing an algorithm  For your own use in the future - Don't have to rethink the problem.  So others can solve the problem, even if they know very little about the principles behind how the solution was derived.
  • 13. Examples of Algorithms  Washing machine instructions  Instructions for a ready-to-assemble piece of furniture  A Classic: GCD - Greatest Common Divisor - The Euclidean Algorithm
  • 14. Washing Machine Instructions  Separate clothes into white clothes and colored clothes.  For white clothes:  Set water temperature knob to HOT.  Place white laundry in tub.  For colored clothes:  Set water temperature knob to COLD  Place colored laundry in tub.  Add 1 cup of powdered laundry detergent to the tub.  Close lid and press the start button.
  • 15. Observations  There are a finite number of steps.  We are capable of doing each of the instructions.  When we have followed all of the steps, the washing machine will wash the clothes and then will stop.  Are all of the clothes clean ?  Do we want the washing machine to run until all of the clothes are clean ?
  • 16. Refinement of the Definition  Our old definition:  An algorithm is a step by step solution to a problem.  Adding our observations:  An algorithm is a finite set of executable instructions that directs a terminating activity.
  • 17. Instructions for a Ready-to-Assemble Furniture  "Align the marks on side A with the grooves on Part F “  Why are these instructions typically so hard to follow ?  Lack of proper tools - instructions are not executable  Which side is A ? A & B look alike. Both line up with Part F - Ambiguous instructions.
  • 18. Final Definition An algorithm is a finite set of unambiguous, executable instructions that directs a terminating activity.
  • 19. History of Algorithms  The study of algorithms began as a subject in mathematics.  The search for algorithms was a significant activity of early mathematicians.  Goal: To find a single set of instructions that could be used to solve any problem of a particular type.
  • 20. GCD- Euclidean Algorithm  Assign M and N the value of the larger and the value of the smaller of the two positive integer input values, respectively.  Divide M by N and call the remainder R.  If R is not 0, then assign M the value of N, assign N the value of R and return to step 2, otherwise the greatest common divisor is the value currently assigned to N.
  • 21. Finding GCD of 24 & 9 MNR 24 9 6 963 630 So 3 is the GCD of 24 and 9.  Do we need to know the theory that Euclid used to come up with this algorithm in order to use it ?  What intelligence is required to find the GCD using this algorithm ?
  • 22. Idea Behind the Algorithms  Once an algorithm behind a task has been discovered  Don't need to understand the principles.  Task is reduced to following the instructions.  Intelligence is "encoded into the algorithm"
  • 23. Algorithm Representation  Syntax and Semantics  Syntax refers to the representation itself.  Semantics refers to the concept represented.