GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Concepts
Go To First  |  Previous Question  |  Next Question 
 Concepts  |  Question 17 of 24    Print  
How do you implement "Queue" functionality by using "2 Stacks"

  
Total Answers and Comments: 1 Last Update: July 17, 2007     Asked by: Guna S 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
July 17, 2007 03:07:05   #1  
saradalincoln Member Since: June 2007   Contribution: 1    

RE: How do you implement "Queue" functionality by usin...
hi

1. Take 2 empty stacks.
2. Fill the 1st stack with some items (eg: input 100 101 102 103)
3. Now read the items from 1st stack in LIFO order and write to 2nd stack.
(By this the 2nd stack will get the items in the order .. 103 102 101 100)
4. Now read the items from 2nd stack in LIFO order i.e. the output will be
100 101 102 103.
(this is the queue order FIFO with respect to the actual items entered in 1st
stack.)


Thanks
Sarada.

 
Is this answer useful? Yes | No

 Related Questions

Latest Answer : hi,1. Take 2 empty stacks.2. Fill the 1st stack with some items (eg: input 100, 101, 102, 103)3. Now read the items from 1st stack in LIFO order and write to 2nd stack.     (By this the 2nd stack will get the items in the order .. 103, ...
Read Answers (1) | Asked by : Guna S


 Sponsored Links

 
Related Articles

Concepts of Object-Oriented Programming

Object Oriented JavaScript In this chapter you ll learn about OOP Object Oriented Programming and how it relates to JavaScript As an ASP NET developer you probably have some experience working with objects and you may even be familiar with concepts such as inheritance However unless you re already a
 

SOA Concepts

SOA Concepts Today the concept of Service Oriented Architecture has become ubiquitous Evidence from recent years establish that SOA is not just about hype but a part of every major Business environment The truth is Service Oriented Architecture can be beneficial to Business only when it is utilized
 

Peer-to-Peer and Client-Queue-Client Architecture

Peer to Peer and Client Queue Client Architecture Client Server Architecture Compared with Peer to Peer and Client Queue Client Architecture Client Server Architecture Client Server Architecture which is the model for Internet communication separates client programs machines from server programs mac
 

The Interview Snafu

How to turn someone else’s mistake to your advantage Your dream job is about to become reality. A recruiter gave you the heads up about the perfect position at Humungous Conglomerate, Inc. You went through five interviews as well as a battery of psychological tests mandated by their HR de
 

Winning a Job Interview with a Winning Resume

Does your resume unlock your potential, take your skills to the highest level and win you the interview and the job you want now? The job market today is highly competitive and even if you think you have what it takes to get an interview you won’t get over the line without a polished, prof
 

WinRunner Programming Concepts

If you want to create WinRunner scripts that are highly efficient, there are important programming concepts that you will want to become familiar with. Understanding these concepts will provide you with a large number of key benefits. In addition to understanding these concepts, you must also learn
 

Importance of Proper English during Job Interview

Importance of Proper English during Job Interview Your job interview is crucially important and it will determine whether or not you will get the job Depending on the type of job you re going for it is very important for you to use proper English In most cases jobs which offer higher salaries will h
 

Web 2.0 Concepts

Web 2 0 Concepts There are a number of important innovations which are expected to play a pivotal role in the introduction of Web 2 0 Some of these innovations are applications that are web based One of the most powerful tools that has allowed this is Ajax mosgoogle Ajax is powerful because it has n
 

HR Interview - HR Interview Mistakes You Will Want To Avoid

HR Interview Mistakes You Will Want To Avoid The job interview can be a stressful process This is especially true for those who are going after a competitive position Your nonverbal communication combined with the answers you give during the interview will determine if you are hired mosgoogle While
 

HR Interview - Behavioral HR Interviews

Behavioral HR Interviews As the name implies a behavioral interview is an interview that is held by a human resources department to determine if an applicant has the behaviors that are appropriate for a job The company must know how an applicant will behave in a certain situations mosgoogle The logi
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape