<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Aniket pagedar </title>
    <description>The latest articles on DEV Community by Aniket pagedar  (@aniketpagedar).</description>
    <link>https://dev.to/aniketpagedar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F667105%2F75b6725c-5b9e-480c-ad72-6f74a25cf56c.png</url>
      <title>DEV Community: Aniket pagedar </title>
      <link>https://dev.to/aniketpagedar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aniketpagedar"/>
    <language>en</language>
    <item>
      <title>Circular queue</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Wed, 13 Dec 2023 00:12:42 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/circular-queue-45pp</link>
      <guid>https://dev.to/aniketpagedar/circular-queue-45pp</guid>
      <description>&lt;p&gt;class CircularQueue {&lt;br&gt;
    private int maxSize;&lt;br&gt;
    private int front;&lt;br&gt;
    private int rear;&lt;br&gt;
    private int[] queue;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public CircularQueue(int size) {
    maxSize = size + 1; // One extra space to differentiate between front and rear.
    queue = new int[maxSize];
    front = rear = 0;
}

public boolean isEmpty() {
    return front == rear;
}

public boolean isFull() {
    return (rear + 1) % maxSize == front;
}

public void enqueue(int item) {
    if (isFull()) {
        System.out.println("Queue is full. Cannot enqueue.");
    } else {
        queue[rear] = item;
        rear = (rear + 1) % maxSize;
        System.out.println(item + " enqueued to the queue");
    }
}

public int dequeue() {
    if (isEmpty()) {
        System.out.println("Queue is empty. Cannot dequeue.");
        return -1; // Return a special value to indicate an empty queue.
    } else {
        int item = queue[front];
        front = (front + 1) % maxSize;
        System.out.println(item + " dequeued from the queue");
        return item;
    }
}

public void display() {
    System.out.print("Queue: ");
    int i = front;
    while (i != rear) {
        System.out.print(queue[i] + " ");
        i = (i + 1) % maxSize;
    }
    System.out.println();
}

public static void main(String[] args) {
    CircularQueue queue = new CircularQueue(5);

    queue.enqueue(1);
    queue.enqueue(2);
    queue.enqueue(3);
    queue.enqueue(4);
    queue.display();

    queue.dequeue();
    queue.display();

    queue.enqueue(5);
    queue.enqueue(6);
    queue.display();

    queue.dequeue();
    queue.dequeue();
    queue.dequeue();
    queue.display();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Circular queue</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Wed, 13 Dec 2023 00:12:37 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/circular-queue-4ccm</link>
      <guid>https://dev.to/aniketpagedar/circular-queue-4ccm</guid>
      <description>&lt;p&gt;class CircularQueue {&lt;br&gt;
    private int maxSize;&lt;br&gt;
    private int front;&lt;br&gt;
    private int rear;&lt;br&gt;
    private int[] queue;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public CircularQueue(int size) {
    maxSize = size + 1; // One extra space to differentiate between front and rear.
    queue = new int[maxSize];
    front = rear = 0;
}

public boolean isEmpty() {
    return front == rear;
}

public boolean isFull() {
    return (rear + 1) % maxSize == front;
}

public void enqueue(int item) {
    if (isFull()) {
        System.out.println("Queue is full. Cannot enqueue.");
    } else {
        queue[rear] = item;
        rear = (rear + 1) % maxSize;
        System.out.println(item + " enqueued to the queue");
    }
}

public int dequeue() {
    if (isEmpty()) {
        System.out.println("Queue is empty. Cannot dequeue.");
        return -1; // Return a special value to indicate an empty queue.
    } else {
        int item = queue[front];
        front = (front + 1) % maxSize;
        System.out.println(item + " dequeued from the queue");
        return item;
    }
}

public void display() {
    System.out.print("Queue: ");
    int i = front;
    while (i != rear) {
        System.out.print(queue[i] + " ");
        i = (i + 1) % maxSize;
    }
    System.out.println();
}

public static void main(String[] args) {
    CircularQueue queue = new CircularQueue(5);

    queue.enqueue(1);
    queue.enqueue(2);
    queue.enqueue(3);
    queue.enqueue(4);
    queue.display();

    queue.dequeue();
    queue.display();

    queue.enqueue(5);
    queue.enqueue(6);
    queue.display();

    queue.dequeue();
    queue.dequeue();
    queue.dequeue();
    queue.display();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>QUEUE</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Wed, 13 Dec 2023 00:10:15 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/queue-4b5g</link>
      <guid>https://dev.to/aniketpagedar/queue-4b5g</guid>
      <description>&lt;p&gt;public class circularqueue {&lt;br&gt;
    private int maxSize;&lt;br&gt;
    private int front;&lt;br&gt;
    private int rear;&lt;br&gt;
    private int currentSize;&lt;br&gt;
    private int[] queueArray;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public circularqueue(int size) {
    maxSize = size;
    queueArray = new int[maxSize];
    front = 0;
    rear = -1;
    currentSize = 0;
}

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

public boolean isFull() {
    return currentSize == maxSize;
}

public int size() {
    return currentSize;
}

public void enqueue(int item) {
    if (isFull()) {
        System.out.println("Queue is full. Cannot enqueue " + item);
    } else {
        rear = (rear + 1) % maxSize;
        queueArray[rear] = item;
        currentSize++;
        System.out.println(item + " enqueued to the queue");
    }
}

public int dequeue() {
    if (isEmpty()) {
        System.out.println("Queue is empty. Cannot dequeue.");
        return -1; // You can choose a different value to represent an error condition
    } else {
        int dequeuedItem = queueArray[front];
        front = (front + 1) % maxSize;
        currentSize--;
        System.out.println(dequeuedItem + " dequeued from the queue");
        return dequeuedItem;
    }
}

public int front() {
    if (isEmpty()) {
        System.out.println("Queue is empty. No front element.");
        return -1; // You can choose a different value to represent an error condition
    } else {
        return queueArray[front];
    }
}

public static void main(String[] args) {
    circularqueue queue = new circularqueue(5);

    queue.enqueue(1);
    queue.enqueue(2);
    queue.enqueue(3);
    queue.enqueue(4);
    queue.enqueue(5);

    System.out.println("Front element: " + queue.front());
    System.out.println("Queue size: " + queue.size());

    queue.dequeue();
    queue.dequeue();

    System.out.println("Front element after dequeue: " + queue.front());
    System.out.println("Queue size after dequeue: " + queue.size());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>QUEUE</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Wed, 13 Dec 2023 00:05:13 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/queue-5bdj</link>
      <guid>https://dev.to/aniketpagedar/queue-5bdj</guid>
      <description>&lt;p&gt;import java.util.Scanner;&lt;/p&gt;

&lt;p&gt;public class Main {&lt;br&gt;
    static int[] queue;&lt;br&gt;
    static int n;&lt;br&gt;
    static int front = -1, rear = -1;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter the size:");
    n = scanner.nextInt();
    queue = new int[n];
    int ch;
    do {
        System.out.println("\nEnter your choice:\n 1.INSERT\n2.DELETE\n3.DISPLAY\n0.EXIT");
        ch = scanner.nextInt();
        switch (ch) {
            case 1:
                insert();
                break;
            case 2:
                deleted();
                break;
            case 3:
                display();
                break;
            default:
                System.out.println("enter valid option...");
                break;
        }
    } while (ch != 0);
}

static void insert() {
    Scanner scanner = new Scanner(System.in);
    int item;
    if (rear &amp;gt;= n - 1) {
        System.out.println("queue is overflow");
    } else {
        System.out.print("Enter element to be inserted: ");
        item = scanner.nextInt();
        rear = rear + 1;
        queue[rear] = item;
        if (front == -1) {
            front = 0;
        }
        System.out.println("Insertion done... &amp;amp; item inserted=" + item);
    }
}

static void deleted() {
    if (front == -1) {
        System.out.println("queue is underflow");
    } else {
        System.out.println("Item deleted..." + queue[front]);
        if (front == rear) {
            front = -1;
            rear = -1;
        } else {
            front = front + 1;
        }
    }
}

static void display() {
    if (front == -1) {
        System.out.println("queue is empty");
    } else {
        for (int i = front; i &amp;lt;= rear; i++) {
            System.out.println(queue[i]);
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Linkedlist in java</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Tue, 12 Dec 2023 23:56:22 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/linkedlist-in-java-mkg</link>
      <guid>https://dev.to/aniketpagedar/linkedlist-in-java-mkg</guid>
      <description>&lt;p&gt;import java.util.Scanner;&lt;/p&gt;

&lt;p&gt;class Node {&lt;br&gt;
    int data;&lt;br&gt;
    Node next;&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;public class linkedlist {&lt;br&gt;
    static Node head;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static void main(String[] args) {
    int choice = 0;
    Scanner scanner = new Scanner(System.in);
    while (choice != 9) {
        System.out.println("\n\n*********Main Menu*********");
        System.out.println("\nChoose one option from the following list ...");
        System.out.println("\n===============================================");
        System.out.println("\n1.Insert in beginning\n2.Insert at last\n3.Insert at any random location\n4.Delete from Beginning\n5.Delete from last\n6.Delete node after specified location\n7.Search for an element\n8.Show\n9.Exit\n");
        System.out.println("\nEnter your choice?");
        choice = scanner.nextInt();
        switch (choice) {
            case 1:
                beginsert();
                break;
            case 2:
                lastinsert();
                break;
            case 3:
                randominsert();
                break;
            case 4:
                begin_delete();
                break;
            case 5:
                last_delete();
                break;
            case 6:
                random_delete();
                break;
            case 7:
                search();
                break;
            case 8:
                display();
                break;
            case 9:
                System.exit(0);
                break;
            default:
                System.out.println("Please enter valid choice..");
        }
    }
}

static void beginsert() {
    Node ptr;
    int item;
    ptr = new Node();
    Scanner scanner = new Scanner(System.in);
    if (ptr == null) {
        System.out.println("\nOVERFLOW");
    } else {
        System.out.println("\nEnter value");
        item = scanner.nextInt();
        ptr.data = item;
        ptr.next = head;
        head = ptr;
        System.out.println("\nNode inserted");
    }
}

static void lastinsert() {
    Node ptr, temp;
    int item;
    ptr = new Node();
    Scanner scanner = new Scanner(System.in);
    if (ptr == null) {
        System.out.println("\nOVERFLOW");
    } else {
        System.out.println("\nEnter value?");
        item = scanner.nextInt();
        ptr.data = item;
        if (head == null) {
            ptr.next = null;
            head = ptr;
            System.out.println("\nNode inserted");
        } else {
            temp = head;
            while (temp.next != null) {
                temp = temp.next;
            }
            temp.next = ptr;
            ptr.next = null;
            System.out.println("\nNode inserted");
        }
    }
}

static void randominsert() {
    int i, loc, item;
    Node ptr, temp;
    ptr = new Node();
    Scanner scanner = new Scanner(System.in);
    if (ptr == null) {
        System.out.println("\nOVERFLOW");
    } else {
        System.out.println("\nEnter element value");
        item = scanner.nextInt();
        ptr.data = item;
        System.out.println("\nEnter the location after which you want to insert ");
        loc = scanner.nextInt();
        temp = head;
        for (i = 0; i &amp;lt; loc; i++) {
            temp = temp.next;
            if (temp == null) {
                System.out.println("\ncan't insert\n");
                return;
            }
        }
        ptr.next = temp.next;
        temp.next = ptr;
        System.out.println("\nNode inserted");
    }
}

static void begin_delete() {
    Node ptr;
    if (head == null) {
        System.out.println("\nList is empty");
    } else {
        ptr = head;
        head = ptr.next;
        ptr = null;
        System.out.println("\nNode deleted from the beginning ...");
    }
}

static void last_delete() {
    Node ptr, ptr1;
    if (head == null) {
        System.out.println("\nlist is empty");
    } else if (head.next == null) {
        head = null;
        System.out.println("\nOnly node of the list deleted ...");
    } else {
        ptr = head;
        while (ptr.next != null) {
            ptr1 = ptr;
            ptr = ptr.next;
        }
        ptr.next = null;
        ptr = null;
        System.out.println("\nDeleted Node from the last ...");
    }
}

static void random_delete() {
    Node ptr, ptr1;
    int loc, i;
    Scanner scanner = new Scanner(System.in);
    System.out.println("\n Enter the location of the node after which you want to perform deletion \n");
    loc = scanner.nextInt();
    ptr = head;
    for (i = 0; i &amp;lt; loc; i++) {
        ptr1 = ptr;
        ptr = ptr.next;
        if (ptr == null) {
            System.out.println("\nCan't delete");
            return;
        }
    }
    ptr.next = ptr.next;
    ptr = null;
    System.out.println("\nDeleted node " + (loc + 1));
}

static void search() {
    Node ptr;
    int item, i = 0, flag = 0;
    Scanner scanner = new Scanner(System.in);
    ptr = head;
    if (ptr == null) {
        System.out.println("\nEmpty List");
    } else {
        System.out.println("\nEnter item which you want to search?");
        item = scanner.nextInt();
        while (ptr != null) {
            if (ptr.data == item) {
                System.out.println("item found at location " + (i + 1));
                flag = 0;
            } else {
                flag = 1;
            }
            i++;
            ptr = ptr.next;
        }
        if (flag == 1) {
            System.out.println("Item not found");
        }
    }
}

static void display() {
    Node ptr;
    ptr = head;
    if (ptr == null) {
        System.out.println("Nothing to print");
    } else {
        System.out.println("\nprinting values . . . . .");
        while (ptr != null) {
            System.out.println("\n" + ptr.data);
            ptr = ptr.next;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>USE OF SUPER KEYWORD</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Thu, 07 Dec 2023 00:02:09 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/use-of-super-keyword-196j</link>
      <guid>https://dev.to/aniketpagedar/use-of-super-keyword-196j</guid>
      <description>&lt;p&gt;class BaseClass {&lt;br&gt;
    protected int x;  // Integer variable in the base class&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Constructor for the base class
public BaseClass(int x) {
    this.x = x;
}

// Method to display the value of x in the base class
public void show() {
    System.out.println("BaseClass - Value of x: " + x);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;class SubClass extends BaseClass {&lt;br&gt;
    // Constructor for the subclass&lt;br&gt;
    public SubClass(int x) {&lt;br&gt;
        super(x);  // Call the constructor of the base class&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Method to display the value of x in the subclass
@Override
public void show() {
    System.out.println("SubClass - Value of x: " + x);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public class superkeywo {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        // Create instances of the base class and subclass&lt;br&gt;
        BaseClass baseObj = new BaseClass(10);&lt;br&gt;
        SubClass subObj = new SubClass(20);&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // Call the show() method for the base class
    baseObj.show();

    // Call the show() method for the subclass
    subObj.show();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Inheritance in java using publisher</title>
      <dc:creator>Aniket pagedar </dc:creator>
      <pubDate>Wed, 06 Dec 2023 12:24:40 +0000</pubDate>
      <link>https://dev.to/aniketpagedar/inheritance-in-java-using-publisher-4978</link>
      <guid>https://dev.to/aniketpagedar/inheritance-in-java-using-publisher-4978</guid>
      <description>&lt;p&gt;import java.util.Scanner;&lt;/p&gt;

&lt;p&gt;class publisher1 {&lt;br&gt;
    String publisherName;&lt;br&gt;
    int publisherId;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void getData() {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter Publisher Name: ");
    publisherName = scanner.nextLine();
    System.out.print("Enter Publisher ID: ");
    publisherId = scanner.nextInt();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;public void showData() {&lt;br&gt;
        System.out.println("Publisher Name:" + publisherName);&lt;br&gt;
        System.out.println("Publisher ID: " + publisherId);&lt;br&gt;
    }&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;class Book extends publisher {&lt;br&gt;
    String bookName;&lt;br&gt;
    int bookId;&lt;br&gt;
    String authorName;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void getData() {
    super.getData();
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter Book Name: ");
    bookName = scanner.nextLine();
    System.out.print("Enter Book ID: ");
    bookId = scanner.nextInt();
    scanner.nextLine(); // Consume the new line character
    System.out.print("Enter Author Name: ");
    authorName = scanner.nextLine();
}

public void showData() {
    super.showData();
    System.out.println("Book Name: " + bookName);
    System.out.println("Book ID: " + bookId);
    System.out.println("Author Name: " + authorName);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;public class publisher {&lt;br&gt;
    public static void main(String[] args) {&lt;br&gt;
        Book book = new Book();&lt;br&gt;
        book.getData();&lt;br&gt;
        book.showData();&lt;br&gt;
    }&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void showData() {
}

public void getData() {
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
