Sorting is the process of arranging the elements either in ascending (or) descending order. This process is determined for accessing and organizing data quickly. Sorting helps in optimizing search techniques and operations that make the data more readable and accessible. This involves comparing elements that rearrange the readable and accessible determined by criteria. Types of sorting Sorting in C involves different methods that determine the data in a certain order. C language provides five sorting techniques, which are as follows − Bubble sort (or) Exchange Sort Selection sort ... Read More
The Sublime Text is a popular code editor due to its simplicity, speed and extensibility. While it may not have built-in C++ support, it's very easy to set up Sublime Text for competitive programming in C++. This guide will walk you through configuring Sublime Text to provide a smooth and efficient environment for C++ competitive programming. Steps to Set Up Sublime Text for C++ Competitive Programming 1. Install Sublime TextFirst, we need to install Sublime Text if you haven't already. Go to the Sublime Text website. Download and install the ... Read More
The words "here" and "hear" sound very similar but have different meanings and applications. "Here" describes a particular place or position and is an adverb, but "hear" describes the sensation of sound or hearing and is a verb."Here"The adverb "here" indicates a particular place or position close to the speaker or the object of inquiry. It shows that someone or something is present at a specific location. For example, "Your book is here", "Let's pause here", "Once more, here we go", "This is where I live", "This is the menu".Applications of HereUsed to denote a precise place or location.Used to ... Read More
Converting 12 hour format time to 24 hour format in JavaScript can be easily achieved using various approaches which we will be discussing in this article. For conversion from 12 hour to 24 hour format we check for the modifier(AM or PM). Depending on the modifier we convert the time formats. In this article, we have specified a time at the beginning in 12 hour format. Our task is to convert 12 hour format time to 24 hour format in JavaScript. Approaches to Convert 12-hours format to 24-hours Here is a list of approaches to convert 12 hour format ... Read More
In this article, we will learn to implement Quicksort recursively in JavaScript. Quicksort is one of the most efficient and widely used sorting algorithms, known for its divide-and-conquer approach. What is Quicksort? Quicksort is a divide-and-conquer sorting algorithm that sorts an array by selecting a pivot element and partitioning the array into two subarrays: elements smaller than the pivot and elements greater than or equal to the pivot. It then recursively sorts the subarrays. Algorithm Quicksort follows the below steps − Step 1 − Make any element the pivot (preferably first or last, ... Read More
In this article, we will learn to sort maps by keys in Java. In Java, the Map interface provides a collection of key-value pairs where each key is unique. Sorting a map by its keys can be useful when you want to order the elements based on the keys instead of their values. Sorting a Map in Java Java provides different ways to sort a map by keys. A TreeMap, a part of the java.util package is one of the easiest ways to sort a map. It stores the map entries in a natural order (ascending) based on the ... Read More
Adding rows dynamically to a JTable is a common task in Java Swing when working with user interfaces that involve tabular data. This article walks you through creating a Java Swing application that appends a new row to a JTable when the user inputs data and clicks a button. What is JTable? A JTable is a powerful Swing component for displaying and editing tabular data. By using a DefaultTableModel, we can manage the table's data dynamically, including adding or removing rows. This makes it an excellent choice for applications requiring user interaction. Approach Following are the steps to append a row ... Read More
In this article, we will learn that concurrency in Java allows multiple threads to execute simultaneously, sharing system resources efficiently. One of the methods provided in the Thread class for managing thread execution is the yield() method. What is the yield() Method? The yield() method is a static method of the Thread class that hints to the thread scheduler that the current thread is willing to pause its execution in favor of other threads of the same or higher priority. It is part of Java's concurrency toolbox and is primarily used for fine-tuning thread execution. Syntax of yield function − ... Read More
An interface is like a reference type, similar to a class that enforces the rules that the class must implements(It is a keyword). An interface may have abstract methods i.e. methods without a definition and also constants or variables with fixed value. What is a Runnable interface in Java? If your class is intended to be executed as a thread, then you can achieve this by implementing a Runnable interface. This belongs to the java.lang package. The Runnable interface in Java is a functional interface that enables the compiled code of the class to run as a separate thread. The ... Read More
To set the text of the label component to be left-justified and top-aligned, you need to set the alignment. Set the label to be on the left and top aligned − JLabel label = new JLabel("Department”); label.setVerticalAlignment(JLabel.TOP); Here, we have set the size of the label as well as the color that includes foreground and background color − label.setPreferredSize(new Dimension(220, 70)); label.setOpaque(true); label.setBackground(Color.MAGENTA); label.setForeground(Color.WHITE); In Java, when we talk about setting the content of a JLabel to be left-justified and top-aligned, we are referring to how the text or icon within the label is positioned relative to the label's ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP