Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Engineering Rabie A. Ramadan Lecture 6.

Similar presentations


Presentation on theme: "Computer Engineering Rabie A. Ramadan Lecture 6."— Presentation transcript:

1 Computer Engineering Rabie A. Ramadan Rabie@rabieramadan.org Lecture 6

2 STACKS

3 Linear Lists A Linear List is a list in which each element has a unique successor. In a restricted linear list, addition and deletion of data are restricted to the ends of the list. In a general linear list, addition and deletion of data are allowed everywhere.

4 Stack A stack is a linear list in which additions and deletions of data are restricted to one end, called the top. If we insert a data series into a stack and then remove it, the order of data is reversed. This property is known as the last in – first out.

5 Stack

6 Stack Algorithms 6 Create Push Pop Stack Top Empty Stack Full Stack Stack Count Destroy the stack

7 Push Stack Operation

8 Pop Stack Operation

9 Stack Top Operation

10

11 Conceptual and Physical Stack Implementations

12 Stack Data Structure

13

14

15

16

17

18

19

20

21

22

23

24

25 Assignment : Implement all of the stack functions ? Use the concept of classes 25

26 QUEUES 26

27 Definition 27 A queue is a linear list in which data can only be inserted at one end, called the rear, and deleted from the other end, called the front. Hence, the data are processed through the queue in the order in which they are received (first in  first out – FIFO)

28 28

29 29

30 30

31 31

32 32

33 33 (Continued)

34 34

35 35

36 36

37 37 (Continued)

38 38

39 39

40 40

41 41

42 42

43 43

44 44

45 45

46 46

47 47

48 48


Download ppt "Computer Engineering Rabie A. Ramadan Lecture 6."

Similar presentations


Ads by Google