Total members 11890 |It is currently Fri Apr 19, 2024 2:27 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Assume that a queue of objects is implemented by an array of size N in a circular fashion
Two variables keep track of the front and rear: front and rear, as described in the following class definition.

java code
public class ArrayQueue {
private Object Q[];
private int front,rear;
private int size;
public ArrayQueue(int capacity) {
Q = new Object[capacity];
// variables front and rear are to be initialized here, based // on the requirements below
}
// methods are to be added here based on the requirements below
}

Complete the constructor for ArrayQueue and write the methods enqueue, dequeue, size, front, isEmpty. (Provide a separate solution for each of the following cases.)

1. front is the index of the first element, rear is the index of the last element and the location following the last element is always kept empty.


2. front is the index of the first element, rear is the index of the last element and the location preceding the first element is always kept empty.

3. front is the index of the location preceding the first element, which is always kept empty, rear is the index of the location following the last element, which is always kept empty.

4. . front is the index of the location preceding the first element, which is always kept empty, rear is the index of the last element. (Draw your own picture.)




Author:
Newbie
User avatar Posts: 3
Have thanks: 0 time

ou could implement a Binary Search Tree and put your data into a linked list.

I think this can be used for sorting too but you can use it to count if a particular number is appearing in the list and how many times it is appearing


Author:
Newbie
User avatar Posts: 29
Have thanks: 0 time

thanks for the response..

but can you explain more :d


Author:
Newbie
User avatar Posts: 3
Have thanks: 0 time
Post new topic Reply to topic  [ 3 posts ] 

  Related Posts  to : queue of objects keep track of the front and rear
 Using Web Objects in XML (WOX) to serialize Java objects XML     -  
 vector front     -  
 Can i track calls from mobile phones     -  
 priority queue     -  
 generic queue     -  
 Queue Header     -  
 Circular Queue     -  
 How to track clicks on hash links from Google analytic     -  
 track session from login page-J2EE project     -  
 Get all objects for an entity     -  



cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com