Stacks overview with its applications
Upcoming SlideShare
Loading in...5
×
 

Stacks overview with its applications

on

  • 3,124 views

 

Statistics

Views

Total Views
3,124
Views on SlideShare
3,124
Embed Views
0

Actions

Likes
0
Downloads
49
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Stacks overview with its applications Stacks overview with its applications Presentation Transcript

  • Saqib Saeed Umair Maqbool Hassan tariq
  •  
  • Quick Introduction
    • Stacks are linear lists.
    • All deletions and insertions occur at one end of the stack known as the TOP.
    • Data going into the stack first, leaves out last.
    • Stacks are also known as LIFO data structures ( L ast- I n, F irst- O ut).
  • Basic Stack Operations
    • push – Adds an item to the top of a stack.
    • pop – Removes an item from the top of the stack and returns it to the user.
    • stack top (top, peek) – Copies the top item of the stack and returns it to the user; the item is not removed, hence the stack is not altered.
  • Additional Notes
    • Stacks structures are usually implemented using arrays or linked lists.
    • For both implementations, the running time is O(n).
    • We will be examining common Stack Applications.
  • Stack Applications
    • Reversing Data: We can use stacks to reverse data.
    • (example: files, strings)
    • Very useful for finding palindromes
    • Converting Decimal to Binary
    • Infix to postfix conversion
  • Backtracking
    • Stacks can be used to backtrack to achieve certain goals.
    • Usually, we set up backtrack tokens to indicate a backtrack opportunity.
    • Backtracking in N-Queen problem.
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •