Uploaded by S.K.M sa

-lab3

advertisement
DEPARTMENT OF COMPUTER ENGINEERING & COMPUTER SCIENCE
SCHOOL OF ENGINEERING
LAB TASK
COURSE NAME
: DATA STRUCTURES & ALGORITHMS LAB
COURSE CODE
: SCB 2114 LAB
STUDENT NAME
: SOUHAIL
MOUSSAAIF
STUDENT ID
: 1108211003
PROGRAMME
: BCS
EXPERIMENT #
: LAB 3
EXPERIMENT TITLE
: DEQUE
SUBMISSION DATE
: 8 – 5 - 2022
TYPE OF
ASSIGNMENT
: LAB
LAB-IN-CHARGE
: MR. TOA CHEAN KHIM
MARKS
AWARDED
Late Submission
Within 3 days
from due date
After 3 days from
due date and
within 1 week
from due date
After 1 week of
due date
LAB 3 – DEQUE
Complete the task and submit at the end of the lab. You may refer to the notes.
TASK 1:
Deque is a type of queue which can insert and remove element from both ends. The
implementation of deque using array will require the shift of elements data if a new element
is to be inserted from the front. This method is inefficient as it requires longer time and
memory during program execution. The implementation of this type of deque can be seen in
the class’s notes.
A more efficient way of implementing deque, is by setting the front and rear pointer
accordingly. This way, the data in each element of the array will not be shifted to
accommodate new data. Modify the class’s Deque implementation to accomplish this. You
may refer to Deque’s Algorithm in the class’s notes.
-End of Lab 3-
Task 1 Answer:
Output:
Download