computer engineering rabie a. ramadan lecture 6

Post on 18-Jan-2018

230 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

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.

TRANSCRIPT

Computer Engineering

Rabie A. RamadanRabie@rabieramadan.org

Lecture 6

STACKSSTACKS

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.

StackStack

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.

StackStack

Stack AlgorithmsStack Algorithms

6

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

Push Stack Operation Push Stack Operation

Pop Stack Operation Pop Stack Operation

Stack Top Operation Stack Top Operation

Conceptual and Physical Stack Conceptual and Physical Stack Implementations Implementations

Stack Data Structure Stack Data Structure

Assignment :Implement all of the stack functions ? Use

the concept of classes

25

QUEUES

26

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

29

30

31

32

33

(Continued)

34

35

36

37

(Continued)

38

39

40

41

42

43

44

45

46

47

48

top related