Found 9326 Articles for Object Oriented Programming

Find index of 0 or Any Negative Integer Element Present in Array in Java

Mr. Satyabrata
Updated on 06-Mar-2023 11:16:29

605 Views

As per the problem statement, we have given an array with some random integer values and we have to find out and print the index which contains any zero or negative values. Note - Take an integer array Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5] The index contains Zero and negative values = 2, 3, 4 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5] The index contains Zero and negative values = 0, 1, ... Read More

Find Array Elements Which are Greater than its Left Elements in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 12:24:32

301 Views

An array is a linear data structure in which elements are stored in contiguous memory locations. As per the problem statement, we have given an array with some random integer values and we have to find out the numbers which are greater than its all left elements by using Java programming language. Let’s start! To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5]. The numbers which are greater than its all left elements = 2, 5 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5]. The numbers which are greater than its all left ... Read More

Find Array Elements Which are Greater Than Its Immediate Left Element?

Mr. Satyabrata
Updated on 01-Mar-2023 11:42:26

890 Views

As per the problem statement, we have an array with some random integer values and we need to find out the numbers which are greater than its immediate left element. Note - Take an integer array. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Given Array= [1, 2, -3, -4, 0, 5]. The numbers which are greater than its left element = 2, 0, 5 Instance-2 Given Array= [-1, 0, 4, 6, 8, -5]. The numbers which are greater than its left element = ... Read More

Find All Possible Coordinates of a Parallelogram in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 11:40:21

154 Views

A parallelogram refers to the quadrilateral which has two pairs of parallel sides where opposite sides are equal in length, and the opposite angles are equal in measure. In this article we are going to find all possible coordinates of a Parallelogram. Basically, we will find all the possible coordinates from the given three coordinates to make a parallelogram of a non-zero area. Here the three given coordinates are not fixed points and can change. Therefore, if three coordinates are given, we may claim that there are only three coordinates from which we can build a parallelogram. As per ... Read More

Convert All Lowercase Text of a File into Uppercase in Java?

Mr. Satyabrata
Updated on 01-Mar-2023 11:31:16

2K+ Views

In this article we are going to change all lower-case text to upper-case text in a file in java. Suppose the text file contains the following data − “Merry and Jack are studying.” Then after updating the text file with specific value the result will be − “MERRY AND JACK ARE STUDYING.” This modification is done with the help of toUpperCase() Method. It belongs to the String class in java. Let’s deep dive into this article, to know how it can be done by using Java programming language. To show you some instances Instance-1 Suppose the original content of the ... Read More

Why can’t a Priority Queue wrap around like an ordinary Queue?

Sonal Meenu Singh
Updated on 22-Feb-2023 16:09:59

233 Views

Introduction A queue is an abstract Data type that inserts elements from the Rear end and removes them from the Front end. There are three types of queues: Simple Queue, Priority Queue, and Circular Queue. In this tutorial, we understand why we cannot wrap around a Priority queue and the reasons for it. Priority Queue It is a unique queue that is not based on the FIFO principle for Queue operations. What makes it unique? It is the priority of its elements for removing or deQueue. Each element of the priority queue has some priority and they are removed based ... Read More

Time and Space Complexity Analysis of Queue operations

Sonal Meenu Singh
Updated on 22-Feb-2023 15:51:25

2K+ Views

Introduction Queue is a linear data structure that uses the FIFO approach for inserting and removing its elements. It can be implemented by using arrays and linked lists. In this tutorial, we will analyze the time and space complexity of array based queue for its different operation. Queue Implementation Using Array The principle of Queue is its FIFO approach and it states that the element that enters first in the Queue will be the first to be removed from it. Its elements are inserted at the Rear end. Queue elements are removed from the Front end. The real-life example of ... Read More

Should we declare it as Queue or Priority Queue while using Priority Queue in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 15:37:35

160 Views

Introduction The queue is a linear data structure that follows the FIFO approach to insert and extract its data. A priority Queue is a structured Queue, where all data have some priorities for their processing. In Java, a queue or priority queue is an interface. In this tutorial, we will examine whether we should declare a queue or priority queue as a Priority Queue in Java. Queue A Queue in Java is an interface and that interface belongs to java.util package. The queue interface extends the Collection Interface and this interface has several methods. Queue uses FIFO (First In First ... Read More

How to implement size-limited Queue that holds last N elements in Java?

Sonal Meenu Singh
Updated on 22-Feb-2023 11:58:17

805 Views

Introduction A queue is an interface in Java. It is used to insert elements at one end and remove them from another end. It uses the FIFO principle for its processing. The queue extends the Collection framework and is defined in the Java.util interface. In this tutorial, we will understand the implementation of size limited queue in Java. What is Size Limited Queue in Java? A size-limited queue is a queue with a fixed size of N. It cannot hold elements more than its size. If you try to push more data, it will remove elements from its front ... Read More

Get requests using AJAX by making a Custom HTTP library

Shubham Vora
Updated on 16-Feb-2023 15:35:28

171 Views

We will learn to make a get request using the AJAX by making the custom HTTP library. Let’s learn about the Get request and AJAX before we start with the tutorial. The Get request is used to get or fetch data from the API (Application programming interface). The AJAX stands for Asynchronous JavaScript and XML. The AJAX allows us to load or update new data without reloading the webpage. For example, if you have ever worked with ReactJs, it updates the data without reloading the webpage. If we reload the webpage whenever data updates, it can give a bad user ... Read More

Advertisements