Learning Objectives

  • Understand what psudeo code is
  • Uderstand the term recursion and base case
  • Able to desribe programm efficeny using N notation

Section 2 QUIZ 10mins

Teacher demo on searching for name in directory, page by page o 2 pages at a time. Then using divide and conquer

// Find Name Mark Smith in Directory

Step 0 Pickup book

Step 1 Open in Middle

Step 2 Look at Names

Step 3 If Smith is among names 

Step 4       Call Mark Smith


Step 5           Else if earlier in book

Step 6               Open to middle left half of book

Step 7               Go back to Step 2

Step 8           Else if later in book 

Step 9                 Open to middle right half of book

Step 10               Go back to Step 2

Step 11          Else

Step 12               Stop

Verb Actions -   Boolean expressions (T/F) answers - Loop / Recursiive

This is an example of psudeo code . Note the recursive nature Go Back to Step 2  with Base Case ( Exit Case ) when 

Big O Notation describes the worst case scenario for run time, example search an insorted  list size N worsr case is N steps  (O)n

What is Syntax and Semantics?

if x < y :

    print ( "x less than y" )

else if  x > y :

       print ( "x greater than y" )


      print ( "x equal y" )