How our brains work - PowerPoint PPT Presentation

About This Presentation
Title:

How our brains work

Description:

How our brains work And how it ties in to programming and arrays Storage Sorting Algorithms Etc What is computing? Computing is about computers just as much as ... – PowerPoint PPT presentation

Number of Views:185
Avg rating:3.0/5.0
Slides: 35
Provided by: benj157
Category:
Tags: brains | swallow | work

less

Transcript and Presenter's Notes

Title: How our brains work


1
How our brains work
And how it ties in to programming and
arrays Storage Sorting Algorithms
Etc
2
What is computing?
  • Computing is about computers just as much as
    astronomy is about telescopes
  • Computing is not just hardware etc..
  • Its a science

3
Why is it called computer science?
  • Just because our brains do it automatically
    doesnt mean everything else will
  • We study how our brains do thingsand try and
    replicate that in an in-animate system.

4
Numbers on a visual screen presented to your brain
81
53
32
Your brain contains the information (the
Algorithim, if you like) To do stuff with these
numbers. You could add the numbers Sort the
numbers from smallest to largest.
5
How do we make a computer sort numbers?
81
53
32
SORT
Programming code Put behind this to sort! For
instance. Declare variables 1 2 and 3 For i is 1
to 3 If 1 gt 2 then move 1 to Right. Next i
3253.81
6
Our brains do this automatically
  • Much of computer science
  • Is copying the way the brain works
  • Making a system a computer that can do what our
    brains do!

7
Algorithms in our brain (that resemble a sort
program)
  • At any given time, you can do a million different
    things,
  • You could
  • SIT STILL
  • WALK
  • RUN
  • SWALLOW
  • SING
  • TALK
  • THINK ABOUT YOUR EX BOYFRIEND
  • THINK OF A PLAN TO KILL Person X
  • EAT SOMETHING that is in your pocket
  • CLIMB A TREE

8
(No Transcript)
9
SIT STILL WALK RUN SWALLOW SING TALK THINK ABOUT
YOUR EX BOYFRIEND THINK OF A PLAN TO KILL Person
X EAT SOMETHING that is in your pocket CLIMB A
TREE
10
Take the simplest of processes like EATING
11
Eating
Lift Spoon
Swallow
Taste
Chew
Spit
Chew Again
Bite
Transfer to Molars
Swallow again
Open Mouth
Close Mouth
12
Eating
Lift Spoon
If food looks edible Else If Food tastes
nice Else
Swallow
Lift Spoon
Taste
Chew
Put spoon down
Spit
Chew Again
Bite
Bite
Taste
Transfer to Molars
Swallow again
Swallow
Open Mouth
Close Mouth
Spit
Put spoon down
13
Eating
If food looks edible Else If Food tastes
nice Else
Lift Spoon
Put spoon down
Bite
Taste
Swallow
Spit
14
Use of Loops?
Child genius could recite timestables (up to 20)
at age 4
15
Reciting timestables
Task Recite your two timestable starting at 1
and stop at 10.
  • 2 times 1 is 2
  • 2 times 2 is 4
  • And so on
  • HOW DOES YOUR BRAIN DO THIS?

16
Immediately
  • The brain sets a START AND STOP
  • i.e starts at 1
  • Stops at 10
  • This is a loop!

17
Three types of loops
  • WHILE LOOPS
  • REPEAT UNTIL LOOPS
  • FOR LOOPS

Declare i as integer i1 While I lt10 then i2
answer
Declare i as integer i1 Repeat i 2
answer Until i10
Dim i as integer For i 1 to 10 i i2 Next i
18
Computers (in order to even remotely resemble our
brains) need to be programmed.
  • Algorithms are developed to do what we imagine is
    something very very simple

19
Algorithims will typically involve
  • One or more of The FOUR MAIN programming
    constructs

20
What are the main programming constructs?
  • Sequence (sequential programming) just a whole
    load of STATEMENTS
  • Iteration (loops While, Repeat, For)
  • Selection (if statements, case statements)

Recursion a very complex type of function That
calls itself
21
What are loops how do they work
  • All loops have a start stop
  • i.e they all have a STOPPING CONDITION..
  • Otherwise they would go on forever!

22
How many loops do you see here?
23
Have I correctly identified the start and stop of
each loop?
24
Have I correctly identified the start and stop of
each loop?
25
Recursion
  • Module Module1
  • Dim a As Integer 3
  • Dim b As Integer 3
  • Sub Main()
  • add(a, b)
  • Console.ReadLine()
  • End Sub
  • Function add(ByVal a, ByVal b)
  • If a 0 Then
  • Return b
  • Else
  • add (a - 1) (b 1)
  • Console.WriteLine(add)
  • End If
  • End Function

26
Recursion
  • Function (x)
  • If x 1
  • Return 1 else
  • Function x - Function (x-1)
  • x3
  • What is the value returned by Function?

27
And whats an Array?
  • What is a variable?
  • A variable is like a like a space you need to
    declare so that the computer knows to set aside
    a block of space to store something that it may
    need to compute

28
If you are given two numbers
60
40
29
Add those two numbers up now
Number 2
Number 1
Number 3
30
What is the capital of egypt?
31
What is the answer of the addition of those two
numbers?
Number 3
100
Your brain stored the number 100 somewhere! In a
computer we call this storage the use of a
VARIABLE
32
Say you had a whole load of numbers
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

Instead of setting aside 9 blocks of space in
Your head for these numbers you might set
aside 1 BLOCK OF SPACE and call it counting
up That waywhenever anyone said COUNTING
UP Youd remember to count up from 1 to 9and
youd Remember the 9 numbers THIS IS CALLED AN
ARRAY (lots of variables)
33
Array counting up
Index number
0 1 2 3 4 5 6 7 8
1 2 3 4 5 6 7 8 9
34
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com