presentation on stacks

Views:
 
Category: Education
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Slide 1: 

10

Slide 2: 

9

Slide 3: 

8

Slide 4: 

7

Slide 5: 

6

Slide 6: 

5

Slide 7: 

4

Slide 8: 

3

Slide 9: 

2

Slide 10: 

1

STACKS : 

STACKS

STACKS : 

STACKS The word stack, at first sight, might bring something like this onto your mind.

Slide 14: 

Or this

Slide 15: 

Or maybe even this

Slide 17: 

1001110010101010100010111010101001010110101001001010101101011101000101010101010001010010111001001010100010101000101011110101010101001110101010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100

Slide 18: 

01101101100101010001010000101001101110011101001010101000101010101011101110010101000101000010101001100001110100101010100010101010101110111001010100010100001010101100010111010010101010001010101010111011100101010001010000101010110001011101001010101100101010101011101110010101000101000010101011000101110100101010100010101010101110111001010100010100001010101100010011100100101010001010100110100011100101010001010000101010110001011101001010101000101010101011101110010101000101000010101011000101110101

Slide 19: 

01101101 01100101 01101000 01110010 01100001 01101110

01101101 = m 01100101 = e 01101000 = h SINCE 01110010 = r 01100001 = a 01101110 = n : 

01101101 = m 01100101 = e 01101000 = h SINCE 01110010 = r 01100001 = a 01101110 = n 01101101 m 01100101 e 01101000 h 01110010 OR r 01100001 a 01101110 n Stacks are LIFO structures.

FORMATION AND USAGE OF STACKS : 

FORMATION AND USAGE OF STACKS

Slide 22: 

MUET[]={m,e,h,r,a,n}; 6. m 5. e 4. h 3. r 2. a 1. n TOP=1. Name of stack= MUET[6].

Slide 23: 

Book 1 Book 2 Book 3 . . Book 8 . . . . . . . . Nth book

Slide 24: 

MUET[]={m,e,h,r,a,n}; 6. m 5. e 4. h 3. r 2. a 1. n TOP=1. Name of stack= MUET[6].

Tasks that can be performed on stacks : 

Tasks that can be performed on stacks Traversing Insertion Deletion

TRAVERSING : 

TRAVERSING

Insertion in stack (PUSH) : 

Insertion in stack (PUSH) r a a n n n TOP=1 TOP=2 TOP=3

Slide 28: 

The procedure includes four arguments. Maxstk = the maximum numbers of elements the array can contain Stack = the stack itself Top = the value of last location Item = the item to be inserted Before insertion check condition if Top=maxstk. Initially Top=0 When item ‘n’ is inserted: Top=1 (value of top is changed to 1) When item ‘a’ is inserted: Top=Top+1 = 1+1 = 2 (value of top is changed to 2) When item ‘r’ is inserted: Top=Top+1 = 2+1 = 3 (value of top is changed to 3)

Deletion from Stack (POP) : 

Deletion from Stack (POP) m e e h h h r r r a a a n n n TOP=6 TOP=5 TOP=4

Slide 30: 

The procedure includes three arguments. Stack = the stack itself Top = the value of last location Item = the item to be inserted Check whether top=null. Otherwise proceed Initially Top=n : Top=6 When item ‘m’ is deleted: Top=Top-1 : Top=6-1 = 5 (value of top is changed to 5) When item ‘e’ is deleted: Top=Top-1 = 5-1 = 4 (value of top is changed to 4) When item ‘h’ is deleted: Top=Top-1 = 4-1 = 3 (value of top is changed to 3)

Arithmetic Expressions : 

Arithmetic Expressions Prefix/Polish Infix Postfix/Reverse Polish

Practical usage : 

Practical usage Quick sort Merge sort

THAT’S ALLTHANK YOU : 

THAT’S ALLTHANK YOU

QUESTIONS PLEASE : 

QUESTIONS PLEASE Presented by: Muhammad Ahsan 10TL48

authorStream Live Help