Binary search is a fast searching algorithm with run-time complexity of Ο(log n). This search algorithm works on the principle of divide and conquer. For this algorithm to work properly, the data collection should be in the sorted form. The binary search looks for a particular item by comparing the middle most item of the collection. If a match occurs, then the index of the item is returned. If the middle item is greater than the item, then the item is searched in the sub-array to the left of the middle item. Otherwise, the item is searched for in the sub-array to the ... Read More
Introduction to Near Field Communication (NFC) Near Field Communication (NFC) may be a short-range remote communication technology that permits two electronic gadgets to set up communication when they are set in the near vicinity, ordinarily inside some centimeters. NFC is an expansion of Radio Recurrence Distinguishing Proof (RFID) innovation and works at a recurrence of 13.56 MHz. NFC innovation empowers contactless communication and information trade between gadgets, making it helpful and proficient for different applications. Working of NFC The essential rule behind NFC is using electromagnetic areas for information exchange. It utilizes inductive coupling, where the NFC-enabled gadgets create attractive ... Read More
Interrupt is an issue that is not caused by the CPU but is done by a component. Interrupts may occur suddenly and CPU has to take immediate action to resolve the issue. Interrupts are of many types and in this article, we will discuss the difference between Maskable and Non-Maskable Interrupts. What is Maskable Interrupt? Maskable interrupt is a kind of interrupt which can be ignored or disabled by instructions given by the CPU. The ignoring or disabling of this interrupt allows the system to give priority to certain tasks. The sources of interrupts are also disabled so that critical ... Read More
A keyboard is an input device which is used in computers and typewriters to type different types of alphabets, numerals, and symbols. In the case of computers, the characters typed through the keyboard are visible on the screen. Previously, keyboards were used only for typing but now games can also be played. Keyboards are of many types and in this article, we will discuss the difference between mechanical and membrane keyboards. What is a Membrane Keyboard? A membrane keyboard consists of three layers of membrane. The location of each key is different on the three-layered membrane. The membrane is sensitive ... Read More
As a developer, you probably love coding but dread the inevitable merge conflicts that come with Git. These conflicts can disrupt your flow and waste precious time. Fortunately, there's a way to automate the resolution process, ensuring you can keep working smoothly. In this article, I'll show you how to set up automatic conflict resolution in Git, favoring either your changes or those from another branch. My First Encounter with Merge Conflicts I remember my first major merge conflict like it was yesterday. I had just finished a big feature and was excited to merge my branch. Instead of celebrating, ... Read More
The GregorianCalendar class in Java allows us to manipulate dates and times easily. In this example, we will create a GregorianCalendar object and use it to display the current date and the date of the previous month. Problem Statement Write a Java program and create a GregorianCalendar object, display the current date, and then modify this date to show the date of the previous month. Output Current date: Mon Nov 19 18:07:03 UTC 2018 Input Modified date (Previous Month): Fri Oct 19 18:07:03 UTC 2018 Steps to display previous month from GregorianCalendar Below are the steps to display previous ... Read More
In this section, we are going to write a Java program to find maximum odd number in an Array using Stream and Filter. Odd numbers are the numbers which cannot be divided by 2 or these numbers give remainder as 1 when they are divided by 2. In other terms which can be written in the form of 2n+1. We will find the maximum odd number in the array. Problem Statement Write a program in Java to find maximum odd number in array using stream and filter − Input array = {1, 7, 2, 3, 9, ... Read More
String, the series of characters, used in Java programming enable to save memory consumption and boost the performance. We can save a string to a file using Java program can be initiated in multiple ways and has been introduced in Java version 11. Four parameters can be used to save a string to a file using Java. They are the file path, character sequence, charset, and options. File path and character sequence, these two are the most important and mandatory for this approach to write into a file. This technique encodes the characters as the content, and it returns the ... Read More
An array can be sorted in case-insensitive order using the java.util.Arrays.sort() method. Also the java.text.Collator class is required as Collator.getInstance() is used to obtain the Collator object for the required locale. Problem Statement Write a program in Java to sort an array of strings in a case-insensitive order. A program that demonstrates this is given as follows − Input The unsorted array is: [apple, mango, Banana, Melon, orange] Output The sorted array in case-insensitive order is: [apple, Banana, mango, Melon, orange] Steps to sort an array in case-insensitive order Below are the steps to sort an array in case-insensitive ... Read More
In this article, we will learn how to replace a specific word in a sentence with asterisks using Java. This technique can be useful for obscuring certain words in a text for privacy or censorship purposes. Problem Statement Develop a program in Java that takes a sentence and a word to be censored as input, then outputs the sentence with the specified word replaced by asterisks, while preserving the original format of the sentence. Input This is a sample only, the sky is blue, water is transparent Output This is a ****** only, the sky is blue, water is transparent ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP