1 / 80

Abstraction and Abstract Thinking Part 1 “Algorithms” Part 2 “Abstract Networks”

Abstraction and Abstract Thinking Part 1 “Algorithms” Part 2 “Abstract Networks”. Recap Statement of The Problem Theory of the Problem Modelling of the Problem Algorithmic description Programming the Algorithm Executing the Program. Future delights. today. done. done. Abstraction.

Download Presentation

Abstraction and Abstract Thinking Part 1 “Algorithms” Part 2 “Abstract Networks”

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Abstraction and Abstract Thinking Part 1 “Algorithms” Part 2 “Abstract Networks”

  2. Recap Statement of The Problem Theory of the Problem Modelling of the Problem Algorithmic description Programming the Algorithm Executing the Program Future delights today done done

  3. Abstraction The ability to separate the high level view of an entity or an operation from the low-level details of its implementation.

  4. Abstract Process / (Data) Non-Abstract Process / (Data)

  5. A Fun Algorithm Take the first three digits of your phone number and multiply by 80 Add 1 to the result Now Multiply by 250 and add the last 4 digits of your phone number Add the last 4 digits of your phone number again Subtract 250 and divide by 2. What do you see?

  6. A Serious Algorithm – Sum of a List Get the list of numbers Set sum to zero Move through the list until it is ended get the next number in the list add it to the sum Output the sum

  7. A fun Algorithm - Stable Marriage The Gale-Shapley algorithm involves a number of iterations. Each unengaged man proposes to the preferred woman to whom he has not yet proposed. Each woman then considers all her suitors and tells the one she most prefers "Maybe" and all the rest of them "No". She is then provisionally "engaged". In each subsequent round, each unengaged man proposes to one woman to whom he has not yet proposed. The women once again replies with one "maybe" and rejects the rest.

  8. Stable Marriage - Example A W B X C Y D Z A W B X C Y D Z A W B X C Y D Z A W B X C Y D Z

  9. A W B X C Y D Z A W B X C Y D Z A W B X C Y D Z A W B X C Y D Z A W B X C Y D Z

  10. Definition of an Algorithm An algorithm is a well-ordered collection of unambiguous and effectively computable operations that, when executed, produces a result, and halts in a finite amount of time. Schneider and Gersting (2004). Algorithms are concepts which exist outside programming languages. They are abstract method for computing something, whereas a program is an embodiment of this method. Donald Knuth (1966)

  11. Fun -3- Magic Card Trick

  12. Is this an Algorithm? • Consider this example taken from the instructions on the back of a shampoo bottle: • Wet hair • Lather • Rinse • Repeat

  13. Algorithmic Process Non-Algorithmic Process

  14. Examples of Recent Serious Algorithms • Matching of kidney donor – recipients • Traffic-flow engineering • Cancer Research. Examples of “Standard” Computing Algorithms (1a) Sequential Search (1b) Binary Search (2a) Selection Sort (2c) Quicksort

  15. Sequential Search Algorithm - Description Anne Bob Carol Daniel Grant Nathan Sue

  16. Sequential Search Algorithm - Example Anne Bob Carol Daniel Grant Nathan Sue

  17. Binary Search Algorithm - Description • Get the list of names 1,2,3,…N • Set “begin” to 1 and “end” to N • Set “found” to no • While “found” is no • Set “m” to middle value between “begin” and “end” • If “name” is “asked name” • Set “found” to yes • Else if “name” precedes “asked name” set “end” = m - 1 • Else set “begin” to m + 1

  18. Binary Search Algorithm - Example Anne Bob Carol Daniel Grant Nathan Sue

  19. How to Make a Binary Tree

  20. Binary Search (Tree Representation) Daniel Bob Nathan Anne Carol Grant Sue

  21. Depth of a Binary Tree (complete) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 4 2 6 1 3 5 7

  22. Depth of a Binary Tree (incomplete) 1 2 3 4 5 6 7 8 4 2 6 1 3 5 7 8

  23. Comparison of Sequential and Binary Search

  24. Selection Sort Algorithm - Description • Get the list of numbers • Put the wall at the beginning • While there are more elements in the unsorted part • Find the smallest element • Swap with the first element in the unsorted part • Move the wall one element to the right

  25. Selection Sort Algorithm - Example

  26. Quick Sort Algorithm - Description • Get the list • Choose a “pivot” from the list • Move all elements less than the pivot to the left of the pivot and the greater elements to the right of the pivot. • Recursively apply 2,3 to the sub-lists generated

More Related