(Latest Revision: 05/06/2001)
Week 11 Notes for CS 2500, Section 001 -- Spring 2002
CS 2500, Section 001, Tuesday, April 30, 2002
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- I will be absent on Thursday -- we will catch up with
the material in these notes.
-
- Discuss Definition of the queue data type
- Organization -- First-In, First-Out
- Elements -- any given homogeneous set
- Operations
- constructor(s)
- destructor(s)
- bool QueueIsEmpty()
- void QueueInsert(queueItemType NewItem, bool& Success)
- void QueueDelete(bool& Success)
- void QueueDelete(queueItemType& QueueFront, bool& Success)
- void GetQueueFront(queueItemType& QueueFront, bool& Success)
- Discuss applications of the queue data type
- Ready queue in an OS
- Resource queues -- e.g. student registration system
- Simulations -- e.g. traffic, airport, bank
- Radix Sort
- breadth-first search
- Discuss implementations of the queue data type
- array-based implementation
- pointer-based implementation (Work in some discussion of
implementing the deque-as-doubly-linked-list.)
- "as-a-list" implementations
- Discuss pro's and con's of different implementations
- array-based implementation
- PRO: simple code
- PRO: all operations are O(1)
- CON: static allocation
- pointer-based implementation
- PRO: dynamic memory allocation
- PRO: most operations are O(1)
- CON: destructor is O(N)
- CON: extra memory required for each element.
- "as-a-list" implementations
- PRO: extremely easy to program
- PRO: if done a certain way, can be as efficient as coding
"from scratch." -- take care to make both insertion
and deletion efficient.
- PRO: can be done with an array-based list or with a
pointer-based list.
- Start on Trees if time allows
-
CS 2500, Section 001,Thursday, May 02, 2002
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- Discuss binary trees, tables, and binary search trees.
- ADT binary tree -- the ADT is determined by these properties
- Organization -- A binary tree is empty, or consists of a
root with a left subtree and a right subtree. The subtrees
are binary trees.
- Elements -- any given homogeneous set
- Operations -- see the file BT.h for the list and the specs.
- ADT table -- see the specs in Carrano, Chapter 11, p. 529.
- ADT binary search tree
- Organization -- A binary search tree is a binary tree in
which each node contains a key that is an element of a totally
ordered set. For every node N in the tree, all keys in the
left subtree of N are less than the key in N, and all keys in
the right subtree of N are greater than the key in N.
- Elements -- any given homogeneous set
- Operations -- see the file BST.h for the list and the specs.
- Discuss implementation of retrieval.
- Discuss implementation of insertion.
- Discuss implementation of traversal.
- Discuss implementation of deletion.
- What is the reason for using BST's?
-