Lecture 14 – October 12, 2006

 

Returned graded homework/programs  12 and 13 and briefly explained homework/program grading scheme

 

BONUS: I have some  300+ slides from a slide presentation by Eugene Bingue and David Cook about Ada95 which they are willing to share with you.  Please bring a CD to class on Tuesday or bring a thumb drive with you so you can download them.  There are too many to make available on Blackboard and I can’t put them up on the Web for you.   Thank you to Eugene and David for making them available to us.

 

Algorithm definition : IMPORTANT

An algorithm is an unambiguous set of instructions for solving a problem in a finite amount of time.

 

 

Talked about linear search through an unordered list and the amount of work it would require in the best, worst and average cases.

Talked about binary search through an ordered list and the amount of work it would require in the best and worst cases.

 

 

Opened an Excel spread sheet and

*          put in columns for:  N,  N^2,  N*N^2, LOG(N) and populated the spread sheet with  10 values of N.

*          computed the values for N^2,  N*N^2, LOG(N)  and saw how different they are

*          discussed and showed how to enter a series of numbers

*          highlight a group of numbers indicating the start of a series (i.e.  10,20,30)

*          left click on the + sign that appears when you move to the black box at the lower right of the group

*          drag the dotted box that appears down the column as far as you want (to make the series as long as you want)

 

*          related homework: students should  make a line chart comparing  N,  N^2,  N*N^2, LOG(N) for a large number of values and to print it and bring it to class on Tuesday.

 

Talked about Big O notation for indicating the amount of work done by an algorithm

*          related homework: read pages 318-320 in the text book

 

Talked about the factorial function

*          students were asked to write code that would get a number from the keyboard and compute its factorial

*          Chris Flint noted that he got a negative number when he asked for the factorial of 20.

*          Negative number was caused by wrap-around which occurred in twos complement representation of integers

*          We discussed twos complement representation with a 3 bit example

 

Talked about recursion

*          discussed the need for a base case (i.e. stopping case)

*          showed code written by Michael Feldman (taken from his book Softtware Construction and Data Structures with Ada 95)

*          showed how to modify the code to eliminate two return statements

*          identified tail recursion as recursion occurring as the last step in a procedure or function.

*          related homework: read section in textbook on recursion – pages 556-572  (you can stop reading at Towers of Hanoi section)

 

Reminder:  keep working on linked list implementation of queues – It is not due next Tuesday – specification can only be modified to change the storage structure from an array to a linked list cell.  Bring questions about coding it to class on Tuesday.

Midterm Exam :  probable date is October 26th.