Skip to main content

Featured

Difference between Fedora Workstation and Fedora Server

Fedora is a popular Linux distribution that is available in two primary editions: Fedora Workstation and Fedora Server. While both editions share the same underlying technology and software, they are designed with different use cases and target audiences in mind. In this article, we'll take a closer look at the differences between Fedora Workstation and Fedora Server to help you choose the best edition for your needs. Fedora Workstation Fedora Workstation is designed for desktop and laptop computers, and is aimed at developers, designers, and other creative professionals. It comes with a wide range of tools and applications that are tailored to these users, including integrated development environments (IDEs), software development kits (SDKs), and design tools. Some of the key features of Fedora Workstation include: GNOME Desktop: Fedora Workstation comes with the GNOME desktop environment, which provides a modern, user-friendly interface that is optimized for productivity and ease...

Java Circular Queue Implementation

how write the coding for the Circular Queue with most of the methods 

public class CQueue {
private int maxSize; // size of the queue
private int [] queArray; // array Implementation
private int front; // front of the queue
private int rear; // end of the queue
private int nItems; // no of items in the queue

public CQueue(int s){
maxSize = s;
queArray = new int[maxSize];
front = 0;
rear = -1;
nItems = 0;
}

public void insert(int j) {
if ( rear == maxSize -1 )
System.out.println("queue is full");
else {
if(rear == maxSize - 1)
rear = -1;
queArray[++rear]=j;
nItems++;
}
}

public int remove() {
if(nItems==0) {
System.out.println("Queue is empty");
return -99;
}
else {
int temp = queArray[front++];
if (front== maxSize)
front = 0;
nItems--;
return temp;
}
}

public int peekFront() {
if(nItems == 0 ) {
System.out.println("queue is empty");
return -99;
}
else
return queArray[front];
}

public int peekRear() {
if (nItems == 0) {
System.out.println("no data in the Queue");
return -99;
}
else
return queArray[rear];
}

public boolean isEmpty() {
return (nItems == 0);
}

public boolean isFull() {
return (nItems == maxSize - 1);
}
public void noItems() {
System.out.println("no items in the Queue is" + nItems);
}

}

Comments