Lab Session-8 CSIT221 Spring 2003 - PowerPoint PPT Presentation

About This Presentation
Title:

Lab Session-8 CSIT221 Spring 2003

Description:

Given a stack with a few items and a target to look for, this function will find ... swap_me(8) is called, the stack is re-arranged as below: (Pop and show all the ... – PowerPoint PPT presentation

Number of Views:10
Avg rating:3.0/5.0
Slides: 4
Provided by: sunyfr
Category:

less

Transcript and Presenter's Notes

Title: Lab Session-8 CSIT221 Spring 2003


1
Lab Session-8 CSIT221 Spring 2003
  • Lab Exercise Based on Pointers, Pointers,
    Pointers
  • Example

2
Lab Exercise (Demo Due Apr 8 Sec 01 and Apr 10
Sec 02)
  • Using the linked stack implementation, write a
    new member function swap_me() of stacktype class.
    Given a stack with a few items and a target to
    look for, this function will find the target
    within the stack. It will swap the target with
    the item after it in the stack.

3
Example
  • Linked stack contains
  • top-gt3?5?8?13 (with 3 on the top)
  • User wishes to swap 8 down
  • After swap_me(8) is called, the stack is
    re-arranged as below (Pop and show all the items
    to prove that your program works)
  • top-gt3?5?13?8
Write a Comment
User Comments (0)
About PowerShow.com