GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Algorithm/queue_using_stack at master · osemrt/Algorithm

Expand file tree

/

queue_using_stack

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

queue_using_stack

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
stack
stack
 
 
README.md
README.md
 
 
common.h
common.h
 
 
deQueue.c
deQueue.c
 
 
declarations.h
declarations.h
 
 
enQueue.c
enQueue.c
 
 
main.c
main.c
 
 

README.md

We are given a stack data structure with push and pop operations, the task is to implement a queue using instances of stack data structure and operations on them.

Method 1 (By making enQueue operation costly) This method makes sure that oldest entered element is always at the top of stack 1, so that deQueue operation just pops from stack1. To put the element at top of stack1, stack2 is used.

Method 2 (By making deQueue operation costly) In this method, in en-queue operation, the new element is entered at the top of stack1. In de-queue operation, if stack2 is empty then all the elements are moved to stack2 and finally top of stack2 is returned.

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.