LearnPick Navigation
Close

Algorithms Concepts

Published in: Mathematics
427 views
  • Prantik S

    • Kolkata
    • 10 Years of Experience
    • Qualification: MCA
    • Teaches: School level computer, Computer Science, Logic, IT...
  • Contact this tutor

To make a computer do anything, you have to write a computer program. To write a computer program, you have to tell the computer, step by step, exactly what you want it to do. The computer then "executes" the program, following each step mechanically, to accomplish the end goal. When you are telling the computer what to do, you also get to choose how it's going to do it. That's where computer algorithms come in. The algorithm is the basic technique used to get the job done. In mathematics and computer science, an algorithm is a self-contained step-by-step set of operations to be performed. Algorithms exist that perform calculation, data processing, and automated reasoning.

  • 1
    1. 2. 3. 4. 5. 6. Algorithms Chapter Goals What are Algorithms Real Life Examples (origami, recipes) 1. Definition 3. Example: A = B + C Expressing Algorithms — Pseudo-Code Simple Algorithms Recursive Algorithms Time Complexity of Algorithms
  • 2
    Algorithms Computing devices are dumb How to explain to a dumb mechanical / computing device how to solve a problem How to solve a problem using 'a small, basic set of primitive instructions". Complexity of Solving Problems.
  • 3
    Coals of Algorithm Study To develop framework for instructing computer to perform tasks To introduce notion of algorithm as means of specifying how to solve a problem To introduce and appreciate approaches for defining and solving very complex tasks in terms of simpler tasks;
  • 4
    Computer Science and Algorithms Computer Science can be considered... as study of algorithms including their formal properties Their hardware and software realisations Their applications to diverse areas
  • 5
    Algorithms: Real Life Examples Many Real-Life Examples Cooking: Recipe for preparing a dish Origami: The Art of Paper Folding Directions: How to go to Changi Airport Remember: Framework: How to give instructions; Alg: The actual step-by-step instructions; Abstraction: Decomposing / Simplifying
  • 6
    Real Life Example: Cooking Framework: "Cooking or Recipe language' Algorithm: "Recipe for a Dish" (step by step instructions on how to cook a dish) Problem Decomposition Preparing Ingredients; Preparing Sauce;
  • 7
    Real Life Example: Origami Framework: 'Origami or Paper-Folding language' Algorithm: "Sequence of Paper-Folding Instructions" (step by step instructions for each fold) Problem Decomposition Start with a Bird Base; . , Finish the Head; , Finish the Legs; Finish the Tail;
  • 8
    Real Life Examples: Issues Problems/Difficulties: Imprecise Instructions; Job can often be done even if instructions are not followed precisely Modifications may be done by the person following the instructions; But, NOT for a Computer , Needs to told PRECISELY what to do; Instructions must be PRECISE; Cannot be vague or ambiguous
  • 9
    Definition of Algorithm: An algorithm for solving a problem finite sequence of unambiguousa executable a steps or instructions, which, if followed would ultimately terminate and give the solution of the problem". Note the keywords: Finite set of steps; Unambiguous; Executable; Terminates;
  • 10
    Algorithm Examples? Problem I : What is the largest integer INPUT: All the integers { ... -2, -1, O, 1, 2, . OUTPUT: The largest integer Algorithm: Arrange all the integers in a list in decreasing order; MAX = first number in the list; Print out MAX; WHY is the above NOT an Algorithm? (Hint: How many integers are there?) Problem 2: Who is the tallest women in the world? Algorithm: Tutorial...
  • 11
    Example: Adding two (n-digit) numbers Input.—Twopositivem-digit decimalmumbers— (a and b) Output: The sum c = a + b
  • 12
    How to "derive" the algorithm Adding IS something we all know done it a thousand times, know it "by heart" How do we give the algorithm? A step-by-step instruction to a dumb machine Try an example: 3492 8157 "Imagine you looking at yourself solving it"
  • 13
    Algorithm: Finding sum of A & B StepA : Seuhe-value-of carry to 0 Step 2: Set the value of i to l. Step 3: Repeat steps 4 through 6 until the value of i is > m. Step 4: Add ai and bi to the current value of carry, to get Xi. Step 5: If < 10 then let q=xi and reset carry to 0. Else i.e. 10 let q=xi - 10 and reset carry to l. Step 6: Increase the value of i by l. Step 7: Set cm +1 to the value of carry. Step 8: Print the final answer c Step 9: Stop.
  • 14
    Expressing Algorithms to Computer To communicate algorithm to computer Need way to "represent" the algorithm Cannot use English Can use computer language machine language and programming languages (Java, Pascal, C) But, these are too tedious (&technical) Use Pseudo-Code instead...
  • 15
    Pseudo-Code to express Algorithms Pseudo•Code Mixture of computer language and English Somewhere in between precise enough to describe what is meant without being too tediuos Examples: Let c be O; Sort the list of numbers in increasing order; Need to know both syntax — representation semantics — meaning
  • 16
    Characteristics of Algorithm Correctness Complexity --- time, space (memory), etc Ease of understanding Ease of coding Ease of maintainence

Discussion

Copyright Infringement: All the contents displayed here are being uploaded by our members. If an user uploaded your copyrighted material to LearnPick without your permission, please submit a Takedown Request for removal.

Need a Tutor or Coaching Class?

Post an enquiry and get instant responses from qualified and experienced tutors.

Post Requirement

Related PPTs

Query submitted.

Thank you!

Drop Us a Query:

Drop Us a Query