Lab05 DS
Lab05 DS
LAB MANUAL # 05
Course Instructor: Lecturer Anum Abdul Salam
Total 100
Lab Description:
A stack is a restricted linear list. All additions and deletions are made at one end, the top. Stacks
are known as last in, first out (LIFO) data structures. Stacks can be implemented using:
Application of Stacks:
LAB TASKS
1. Design stack ADT using static approach and provide all the following functions.
i. Push (insert at start)
ii. Pop (delete from start)
iii. Retrieve Top (return top most element without deleting it)
iv. Is Empty (to check is stack is empty)
v. Destructor
vi. Default constructor
TEST PLAN:
Execute your test plan. If you discover mistakes in your implementation of the List ADT, correct
them and execute your test plan again.
5. Insert 6 in myStack
2. Design stack ADT using dynamic approach provide all the following functions.
i. Push (insert at start)
ii. Pop(delete from start)
iii. Retrieve Top (return top most element without deleting it
iv. IsEmpty (to check is stack is empty)
v. Copy Constructor (for deep copying stack)
vi. Destructor (De allocating stack memory)
vii. Default constructor
TEST PLAN:
Execute your test plan. If you discover mistakes in your implementation of the List ADT, correct
them and execute your test plan again.
Sr. Operations Expected Results Results/Status
5. Insert 6 in myStack
3. Design stack ADT using Linked list provide all the following functions.
i. Push (insert at start)
ii. Pop(delete from start)
iii. Retrieve Top (return top most element without deleting it
iv. IsEmpty (to check is stack is empty)
v. Copy
Constructor (for deep copying stack)
vi. Destructor (De allocating stack memory)
vii. Default constructor
THINK:
1. What are the advantages of doubly linked list over singly linked list?
2. What are some applications of stacks?
3. In what scenario you’ll prefer using static stack implementation?
4. What is difference between implementation of static and dynamic stack in term of memory?