(Latest Revision: 04/25/2001)
Week 10 Notes for CS 2500, Section 002 -- Spring 2001
CS 2500, Section 002, Tuesday, April 24, 2001
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- 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."
- PRO: can be done with an array-based list or with a
pointer-based list.
- CON: There is extra function-call overhead.
- CON: can be very inefficient if not done carefully -- the
example code is inefficient if the list has the array
implementation, and is efficient if the list has the
linked implementation.
-
CS 2500, Section 002,Thursday, April 26, 2001
- Look at Upcoming Schedule
- Class starts at 09:40. I take roll at 09:50
- Announcement(s)
- I will be holding office hours in the quad today
-- in front of the SUB at the CFA table.
-
- 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
- "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.
-
-