1 / 14

Problem Solving :

Problem Solving :. Introduction to principles of computation. HOMEWORK DUE NEXT THURSDAY. Programming Tasks 7, 8, 9 ,10 Fully annotated code copied into a Word Processed document. LibreOffice 4: The free office suite the community has been dreaming of for twelve years

Download Presentation

Problem Solving :

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. Problem Solving: Introduction to principles of computation

  2. HOMEWORK DUE NEXT THURSDAY • Programming Tasks 7, 8, 9 ,10 • Fully annotated code copied into a Word Processed document. LibreOffice4: The free office suite the community has been dreaming of for twelve years • Your name in the Header of the document. • Document printed and submitted for marking at the start of the lesson, NOT DURING THE LESSON.

  3. SPOT THE ERRORS Dim moneyLeft As Decimal = 50000 Dim foodSpending As Single Dim tripSpending As String Dim presentSpending As Single Console.Write("How much did you spend on food? ") foodSpending = (Console.WriteLine) Console.WriteLine("How much did you spend on Trips? ") tripSpending (Console.ReadLine) Console.WriteLine("How much did you spend on Presents? ") presentSpending = (Console.ReadLine) moneyLeft = moneyLeft - (foodSpending + tripSpending + presentSpending) Console.WriteLine(You have & moneyLeft & " Euros left to spend") Console.ReadKey()

  4. WHAT IS COMPUTER SCIENCE? Computer science is a discipline that involves the understanding and design of computers and computational processes. In its most general form it is concerned with the understanding of information transfer and transformation. Particular interest is placed on making processes efficient and endowing them with some form of intelligence. The discipline ranges from theoretical studies of algorithms to practical problems of implementation in terms of computational hardware and software.

  5. Computational thinking is made up of four parts DECOMPOSITION PATTERN RECOGNITION PATTERN GENERALISATION AND ABSTRACTION ALGORITHM DESIGN

  6. DECOMPOSITION

  7. PATTERN RECOGNITION n = (i * 3) - 2

  8. PATTERN GENERALISATION & ABSTRACTION Pattern Generalization and Abstraction: The ability to filter out information that is not necessary to solve a certain type of problem and generalize the information that is necessary. Pattern generalization and abstraction allows us to represent an idea or a process in general terms (e.g., variables) so that we can use it to solve other problems that are similar in nature. Examples: A daily planner uses abstraction to represent a week in terms of days and hours, helping us to organize our time. A world map is an abstraction of the earth in terms of longitude and latitude, helping us describe the location and geography of a place.

  9. ALGORITHM DESIGN • The ability to develop a step-by-step strategy for solving a problem. Algorithm design is often based on the decomposition of a problem and the identification of patterns that help to solve the problem. In computer science as well as in mathematics, algorithms are often written abstractly, utilizing variables in place of specific numbers. • Examples: • When a chef writes a recipe for a dish, he/she is creating an algorithm that others can follow to replicate the dish. • When a coach creates a play in football, he is designing a set of algorithms for his players to follow during the game. • declare robot • robot.on • robot.get(body) • robot.get(roof) • do • robot.weld(roof, body) • Until • (robot.weld== success) • robot.off

  10. QUESTIONS • What are the four main parts of computational thinking? • Can you spot a pattern in this set of numbers? Fibonacci Numbers • Can you come up with an algorithm to make a cup of tea?

  11. THE HALTING PROBLEM • Do you think that every process in nature can be simulated by a computer? Very early on in modern computing, a British academic named Alan Turing devised the halting problem. This problem is to do with whether we can determine if a program will ever come to a halt or run for ever. Example: console.writeline(“Hello World")

  12. Dim x as integer = 9 • while x > 8 • console.writeline("hello") • end while • This would never finish, it would never come to a halt as x will always be larger than 8 and never get any smaller. This means the while loop will continue for ever, constantly printing out "hello". In the two cases shown it is easy to tell if a program will halt or not, but it isn't so easy. Imagine we get a more complex piece of code: • Dim x as integer = 9 • Dim total as integer = 0 • while total < 100 • total = total + x • x = x / 2 • end while

  13. Problem Solving: Stages of problem solving • Solving problems is never easy, so you need to break them down into manageable chunks:

  14. THE PROCESS

More Related