<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>queue data structure java - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/queue-data-structure-java/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/queue-data-structure-java/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Mon, 13 Sep 2021 07:15:16 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>queue data structure java - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/queue-data-structure-java/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is Queue in Data Structure ?</title>
		<link>https://www.wikitechy.com/interview-questions/data-structure/what-is-queue-in-data-structure/</link>
					<comments>https://www.wikitechy.com/interview-questions/data-structure/what-is-queue-in-data-structure/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Tue, 13 Jul 2021 15:12:27 +0000</pubDate>
				<category><![CDATA[Data Structure]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Altimetrik India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Apostek Software Interview Questions and Answers]]></category>
		<category><![CDATA[application of queue in data structure]]></category>
		<category><![CDATA[applications of circular queue]]></category>
		<category><![CDATA[applications of queue in data structure]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Bharti Airtel interview questions and answers]]></category>
		<category><![CDATA[BMC Software interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Ciena Corporation interview questions and answers]]></category>
		<category><![CDATA[circular queue in data structure]]></category>
		<category><![CDATA[circular queue in data structure program]]></category>
		<category><![CDATA[Collabera Te interview questions and answers]]></category>
		<category><![CDATA[data queue]]></category>
		<category><![CDATA[define queue]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[equeue in data structure using c]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[Genpact interview questions and answers]]></category>
		<category><![CDATA[Globallogic India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[in queue]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[insertion and deletion in circular queue in data structure]]></category>
		<category><![CDATA[insertion and deletion in queue in data structur]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[paramatrix interview questions and answers]]></category>
		<category><![CDATA[queue data structure in c]]></category>
		<category><![CDATA[queue data structure java]]></category>
		<category><![CDATA[queue example]]></category>
		<category><![CDATA[queue implementation]]></category>
		<category><![CDATA[queue implementation in c]]></category>
		<category><![CDATA[queue in a sentence]]></category>
		<category><![CDATA[queue in c]]></category>
		<category><![CDATA[queue in data structure]]></category>
		<category><![CDATA[queue in data structure using c++]]></category>
		<category><![CDATA[queue operations]]></category>
		<category><![CDATA[queued definition]]></category>
		<category><![CDATA[queuing analysis]]></category>
		<category><![CDATA[queuing process]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Sapient Consulting Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[Tracxn Technologies Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[types of queue in data structure]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[what is queue]]></category>
		<category><![CDATA[what is queue in data structure]]></category>
		<category><![CDATA[Wipro Infotech interview questions and answers]]></category>
		<category><![CDATA[WM Global Technology Services India Pvt.Ltd Limited (WMGTS) interview questions and answers]]></category>
		<category><![CDATA[Xoriant Solutions Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Yodlee Infotech Pvt Ltd interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=489</guid>

					<description><![CDATA[Answer : A queue is a container of objects (a linear collection) that are inserted...]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="what-is-queue-in-data-structure" class="color-pink" style="text-align: justify;">What is Queue in Data Structure ?</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li style="list-style-type: none;">
<ul>
<li>A queue is a container of objects (a linear collection) that are inserted and removed according to the first-in first-out (FIFO) principle.</li>
</ul>
</li>
</ul>
<div class="ImageContent">
<div class="hddn"><img decoding="async" class="img-responsive center-block aligncenter" src="https://cdn.wikitechy.com/interview-questions/data-structure/first-in-first-out.gif" alt="Queue(FIFO)" /></div>
</div>
<ul>
<li>Here the first element is inserted from one end called REAR and deleted from the other end called as FRONT.</li>
<li>Front points to the beginning of the queue and Rear points to the end of the queue.</li>
</ul>
<div class="ImageContent">
<div class="hddn"><img decoding="async" class="img-responsive center-block" src="https://cdn.wikitechy.com/interview-questions/data-structure/what-is-enqueue-dequeue.gif" alt="Enqueue Dequeue" /></div>
</div>
<div class="text-center row">
<div class="col-sm-12">
<div id="bsa-zone_1590522538159-8_123456"></div>
</div>
</div>
<div class="TextHeading">
<div class="hddn">
<h2 id="operations-on-queue" class="color-green">Operations on Queue</h2>
</div>
</div>
<table class="table-bordered table-striped table table-responsive">
<tbody>
<tr>
<th>Operation</th>
<th>Description</th>
</tr>
<tr>
<td class="text-leftalign">enqueue()</td>
<td class="text-leftalign">This function defines the operation for adding an element into queue.</td>
</tr>
<tr>
<td class="text-leftalign">dequeue()</td>
<td class="text-leftalign">This function defines the operation for removing an element from queue.</td>
</tr>
<tr>
<td class="text-leftalign">init()</td>
<td class="text-leftalign">This function is used for initializing the queue.</td>
</tr>
<tr>
<td class="text-leftalign">Front</td>
<td class="text-leftalign">Front is used to get the front data item from a queue.</td>
</tr>
<tr>
<td class="text-leftalign">Rear</td>
<td class="text-leftalign">Rear is used to get the last item from a queue.</td>
</tr>
</tbody>
</table>
<div class="TextHeading">
<div class="hddn">
<h2 id="queue-implementation" class="color-green">Queue Implementation</h2>
</div>
</div>
<div class="ImageContent">
<div class="hddn"><img decoding="async" class="img-responsive center-block aligncenter" src="https://cdn.wikitechy.com/interview-questions/data-structure/what-is-queue-in-data-structure.png" alt=" Queue in Data Structure" /></div>
</div>
<div class="Content">
<div class="hddn">
<ul>
<li>Array is the easiest way to implement a queue. Queue can be also implemented using Linked List or Stack.</li>
<li>Front and Rear of the queue point at the first index of the array. (Array index starts from 0).</li>
<li>While adding an element into the queue, the Rear keeps on moving ahead and always points to the position where the next element will be inserted. Front remains at the first index.</li>
</ul>
<h2 id="sample-code" class="color-blue">Sample Code</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-javascript code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-javascript code-embed-code">import java.io.*;<br/>class Queue <br/>{ <br/>    int front, rear, size; <br/>    int  capacity; <br/>    int array[]; <br/>       <br/>    public Queue(int capacity) { <br/>         this.capacity = capacity; <br/>         front = this.size = 0;  <br/>         rear = capacity - 1; <br/>         array = new int[this.capacity]; <br/>            <br/>    } <br/>       <br/>    // Queue is full when size becomes equal to  <br/>    // the capacity  <br/>    boolean isFull(Queue queue) <br/>    {  return (queue.size == queue.capacity); <br/>    } <br/>       <br/>    // Queue is empty when size is 0 <br/>    boolean isEmpty(Queue queue) <br/>    {  return (queue.size == 0); } <br/>       <br/>    // Method to add an item to the queue.  <br/>    // It changes rear and size <br/>    void enqueue( int items) <br/>    { <br/>        if (isFull(this)) <br/>            return; <br/>        this.rear = (this.rear + 1)%this.capacity; <br/>        this.array[this.rear] = items; <br/>        this.size = this.size + 1; <br/>        System.out.println(items+ &quot; enqueued to the queue&quot;); <br/>    } <br/>       <br/>    // Method to remove an item from queue.   <br/>    // It changes front and size <br/>    int dequeue() <br/>    { <br/>        if (isEmpty(this)) <br/>            return Integer.MIN_VALUE; <br/>           <br/>        int item = this.array[this.front]; <br/>        this.front = (this.front + 1)%this.capacity; <br/>        this.size = this.size - 1; <br/>        return item; <br/>    } <br/>       <br/>    // Method to get front of queue <br/>    int front() <br/>    { <br/>        if (isEmpty(this)) <br/>            return Integer.MIN_VALUE; <br/>           <br/>        return this.array[this.front]; <br/>    } <br/>        <br/>    // Method to get rear of queue <br/>    int rear() <br/>    { <br/>        if (isEmpty(this)) <br/>            return Integer.MIN_VALUE; <br/>           <br/>        return this.array[this.rear]; <br/>    } <br/>} <br/>   <br/>    <br/>// Driver class <br/>public class Test <br/>{ <br/>    public static void main(String[] args)  <br/>    { <br/>        Queue q1 = new Queue(1000); <br/>            <br/>        q1.enqueue(7); <br/>        q1.enqueue(8); <br/>        q1.enqueue(18); <br/>        q1.enqueue(25); <br/>        <br/>        System.out.println(q1.dequeue() +  <br/>                     &quot; dequeued from the queue\n&quot;); <br/>        <br/>        System.out.println(&quot;Front item is &quot; +  <br/>                               q1.front()); <br/>           <br/>        System.out.println(&quot;Rear item is &quot; +  <br/>                                q1.rear()); <br/>    } <br/>}</code></pre> </div>
<h2 id="output" class="color-blue">Output</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markdown code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markdown code-embed-code">7 enqueued to the queue<br/>8 enqueued to the queue<br/>18 enqueued to the queue<br/>12 enqueued to the queue<br/>7 dequeued from the queue<br/><br/>Front item is 8<br/>Rear item is 25</code></pre> </div>
</div>
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/data-structure/what-is-queue-in-data-structure/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
