CS201 is an introduction to algorithms and data structures, and to the analysis of their behaviour. This course will be taught using the language Standard ML, (which has a number of features making it particularly apt for teaching this subject matter). No prior knowledge of SML is assumed, but programming proficiency and experience in a language such as Pascal or C is a prerequisite.
The first section of the course (up to the Easter Break) will introduce the SML language, give a fairly rapid review of concrete data types: integers, strings, booleans, records, lists, and trees, and develop the idea of data abstraction. Small practical exercises will be set to develop your familiarity with these ideas.
The second section of the course will introduce a number of implementations for abstract data types such as sets, dictionaries, and queues, introduce graphs and a repertoire of elementary graph algorithms, and discuss data-structures to support sorting and searching. An initial practical will introduce you to SML modules, then, in a four-week project, you will use a variety of data-structures to build a simple machine-code optimiser.
Assessment will be based on a combination of practical work and two one-hour examinations, given at the end of each section of the course. A detailed schedule of lectures, practical deadlines and examinations is given at the end of this document.
Practical work submitted for assessment is expected to be the result of your individual efforts. You may discuss general principles with others in order to understand the topic—indeed this is encouraged; but, you are responsible for designing and implementing your own solutions.
These are informal question and answer sessions where a member of the teaching staff is available to answer questions about the course and assignments in a small group setting. These will be held on Tue 9-10 am, Tue 10-11am and Tue 4-5pm, accomodation at these classes is limited. You may attend one (1) practise class per week. The practice classes will be discontinued if there is insufficient attendance.
All laboratory sessions will be held the the second year laboratory, on the second floor of the new computer science building.
There will be supervised laboratory sessions scheduled for CS201, commencing in the second week of semester. Seven sessions are provided, at: Wed 9-11am, Wed 11-1pm, Wed 2-4pm, Wed 4-6pm, Thur 9-11am, Thur 2-4pm and Thur 4-6pm. Each student should sign up for one of these sessions during the first week of semester using the sheets outside the Labs. In these sessions, you will be expected to work on the practical exercises, distributed in the Friday lectures, and the project (which will be distributed after the Easter break). Each lab session extends for 2 hours; students registered for the session will have priority access.
However, you may not able to finish the work during the supervised lab session; you are expected to complete it by coming to the laboratory outside the scheduled lab times. You will normally have 24-hour access to the lab. (However, this will not be available until the end of March, when the card entrance system is expected to become operational. Until then, access will be limited to office hours.)
The practical component of the course is considered compulsory and failure to hand in satisfactory practical work may cause a student to be excluded from sitting the CS201 exam.
Monday | Tuesday | Wednesday | Thursday | Friday | |
9 - 11 am | 9am Prac Class | Lab | Lab | ||
(MPF) | (LB) | (MJM) | |||
10am Prac Class | |||||
(MJM) | |||||
11 - 1 pm | Lab | 12pm Lecture | |||
(MJM) | (MPF) | ||||
1 - 2 pm | Lunch | Lunch | Lunch | Lunch | Lunch |
2 - 4 pm | Lab | Lab | 1pm Lecture | ||
(LB) | (MPF) | (MPF) | |||
4 - 6 pm | 4pm Prac class | Lab | Lab | ||
(MJM) | (RS) | (BB) | |||
Thursday CS201 Lecture in Ross Lecture Theatre.
Friday CS201 lecture in Alexander Lecture Theatre.
Labs are in the Second year Lab (Room 2.3).
Practise Classes are in Room 2.28 in the Computer Science Building.
Accomodation at these classes is limited.
Key to Abbreviations
In addition to the practice classes, Michael Fourman (2.24) will be available for questions on this course from 4pm to 5pm on Thursdays, and Mark Messenger (2.18) will be available for student consultation from 9am to 11am on Wednesdays. However, questions of general interest should, where possible, be brought to one of the practice classes.
The recommended book for this course is, ML for the Working Programmer, by Paulson. You are strongly advised to purchase a copy1. One important strand of the CS201 course is an introduction to the functional programming language Standard ML (SML). Paulson will provide an essential reference for this material.
Handouts will accompany each lecture. They will contain a summary of the material covered; however, they will often be terse, and may not include diagrams and examples used in the lectures. The notes are intended as a revision aid, to complement the book, and are not a substitute for lecture attendance.
Some lecture summaries in this note refer to particular pages in Paulson’s book (e.g., P21-24). Please note that it is not always necessary to understand all of the material on these pages — the book sometimes covers a topic in more detail than is required for CS201. You only need to understand the material referred to in the lectures and handouts. The page references will allow you to read ahead if you get time, and you may get more out of the lectures if you do this.
Conversely, not all the material of the course is covered by Paulson’s book. If a lecture summary here doesn’t have a reference to the book, it usually means that the material is spread over a number of chapters, or is covered later in the book using examples you may not understand at that point. However, in some cases, it means that the material is not covered at all in the book; such topics will be covered in greater detail in the lecture notes.
Another book, Introduction to Algorithms, by Cormen, Leiserson and Rivest, (1028 pages) is mildly recommended for further reading on data structures. It is an excellent book and includes most of the topics you will not find in Paulson. However, it will not serve as a reference for ML, and, in general, it is a little advanced for CS2 purposes. If you plan to do a Computer Science Honours degree, it may be worthwhile buying it now. Some handouts will include references to Cormen, Leiserson and Rivest’s book for those who want to learn more about the topics covered, but such reading is not necessary for examination purposes.
These books are available on closed reserve in the library. A selection of alternative ML texts will be mentioned in Lecture Note 1.
The lecture notes are based on material produced, by myself and others, for courses at The University of Edinburgh. In particular, I have drawn extensively from handouts prepared by Gordon Brebner (GB) and Kevin Mitchell (KM) for the CS2Ah course given at The University of Edinburgh. I am also grateful to Stephen Gilmore for several examples taken from his MSc course on Functional Programming, and to Stuart Anderson for his invaluable advice.
The initials of the primary author of each lecture note will appear in its reference number. While credit for the contents of each note is due to this author, it should be noted that I have edited the notes, in some cases extensively, for use at UWA. Responsibility for the mistakes and infelicities I will undoubtedly have introduced is mine.
Michael Fourman, Perth, February 1994.
This course will be assessed by a combination of practical work (40%) and examination (60%). Students who fail to complete the practical component may be excluded from sitting the final examination of CS201.
CS201 is a prerequisite for many other Computer Science and Information Technology units. You may not be permitted to enrol in other CS units, if you do not achieve a satifactory result in CS201.
Examinations will be held in normal class hours, in a venue to be announced.
Expressions, values, and functions. (P15-19)
Basic types (P21-24)
Recursive functions and pattern matching (P45-49)
Managing environments (P49-54)
Simple structured types; Records. (P25-33)
Complex Numbers
Signatures,
Structures,
Functors
Limitations of SML Modules
The datatype declaration (P104-106)
Enumeration types (P107)
Constructors and pattern matching (P109-110)
Exceptions. (P114-116)
Basic list operations (P62-75)
Templates for stack and accumulative recursion
Sets using lists (P87-89)
Queues (P236-250)
Philosophy of Abstract Data Types
The abstype construct
Examples
Limitations of abstype
Representing Trees (P120-122)
Traversing trees (P123-125)
Syntax trees
Equational reasoning
Proving properties of functions using induction
Induction for lists (P199-203)
Induction for trees (P204-207)
This one-hour examination will cover the first section of the course. It will contribute 25% to your final mark.
Association Lists
Sets
Sharing constraints (P264-267)
Views
Styles of use (P268-271)
Definition and applications of graphs
Representation of graphs
Searching graphs: depth-first, breadth-first (P91-92)
Topologically sorting graphs (P93-95)
Kruksal’s algorithm
Prim’s algorithm
Finding paths in graphs
Finding shortest and longest paths
Arrays (P300-304)
Mutable Stacks
Random Permutation
Histograms
Hashing
References (P280-290)
Marking and clearing
Mutable Queues and Lists
Ring Buffers(P296-300)
Simple sequences (P166-174)
Erastosthenes and other examples
Lazy evaluation (P42-44)
A lazy implementation using references (P292-294)
The heap invariant
Binomial heaps
Binary heaps
Quicksort and Mergesort (P95-101)
Binary search trees (P126-129)
AVL trees
red-black trees
2-3 trees
B-trees
Structural induction
Reasoning about functionals (P208-210)
Well-founded induction and recursion (P211-215, 219-225)
Algorithm styles
Data structure styles
Further analysis techniques
This one hour examination will cover topics from the entire course. It will contribute 35% to your total mark.
(C) Michael Fourman 1994-2006