Check If a Particular Value Exists in Java LinkedHashMap

Aishwarya Naglot
Updated on 28-Jul-2025 14:20:51

577 Views

LinkedHashMap is a class in Java that implements the Map interface. It uses a doubly linked list to maintain the insertion order of elements. So, when we loop through a LinkedHashMap, the elements will be returned in the order we had inserted them. The given task is to check if a particular value exists in a LinkedHashMap in Java. Let's look at some scenarios to understand the problem better: Scenario Input: {1=Mikasa, 2=Eren, 3=Reiner}, Value to check: Mikasa Output: Value Exists Explanation: The LinkedHashMap has the value that we are looking for. Checking if a Value Exists in LinkedHashMapThe following ... Read More

Find Area of Circumcircle of Any Triangle with Given Sides in C++

Ravi Ranjan
Updated on 28-Jul-2025 14:09:31

264 Views

Circumcircle of Triangle A circumcircle of a triangle is a circle that passes through all the vertices of a triangle. The center of circumcircle is known as the circumcenter, which is an intersection of all the perpendicular bisectors of the triangle. The radius is known as the circumradius and is denoted by R. Formula to Calculate Area of Circumcircle of Triangle You can use the formula given below to calculate the area of the circumcircle of a triangle: $$ \frac{\pi (abc)^2}{16K^2} $$ where, a, b, and c are the sides of ... Read More

Area of a Square from Diagonal Length in C++

Ravi Ranjan
Updated on 28-Jul-2025 14:08:37

321 Views

A diagonal of a polygon is the line joining two vertices that are not adjacent to each other. The formula for calculating the area of a square with diagonal length is a2 = d2 / 2, where a and d are the side and diagonal length of the square, respectively. The visual representation of the derivation of the formula is given below: Here are some example scenarios to calculate the area of a square from the diagonal length using the above formula: Scenario 1 Input: d = 10 Output: 50 Explanation: Using the formula: area = ... Read More

Area of a Triangle Inside a Parallelogram in C++

Ravi Ranjan
Updated on 28-Jul-2025 14:07:59

573 Views

The area of a triangle is given as (base * height) / 2, and the area of a parallelogram is base * height. For calculating the area of the triangle inside the parallelogram, we divide the area of the parallelogram by 2, i.e., (base * height) / 2, where the base and the height of the parallelogram are given. Here are some example scenarios to calculate the area of a triangle inside a parallelogram using the above formula: Scenario 1 Input: base = 10, height = 8 Output: 40 Explanation: Using the formula: Area ... Read More

Create Quartet Tuple in Java

Alshifa Hasnain
Updated on 25-Jul-2025 19:09:22

162 Views

Java does not have built-in tuple support; to use the tuple, we use the third-party library called Javatuples. This library provides classes representing fixed-size tuples of different sizes. The Quartet class is one of these classes that represents a tuple with 4 values. Creating a Quartet Tuple in Java We can create a Quartet in Java in the following ways: Using a Constructor Using fromCollection() method Using with() method Using fromArray() method Using a Constructor The constructor of the Quartet class accepts ... Read More

2-3 Trees Search and Insert in C++

Aman Kumar
Updated on 25-Jul-2025 17:12:28

906 Views

What is 2-3 Trees? A 2-3 tree is a tree data structure, where each internal node has either 2 or 3 children (also, we can say that 2-nodes and 3-nodes, respectively). It is a type of B-tree that ensures efficient search, insertion, and deletion operations with O(logn) time complexity. Properties of 2-3 tree 2-node contains one data element and has two children (or none if it is a leaf). 3-node contains two data elements and has three children (or none if it is a leaf). Data ... Read More

Arithmetic Mean in C++

Ravi Ranjan
Updated on 25-Jul-2025 17:07:37

2K+ Views

An arithmetic mean is the average of all the given numbers, which is calculated by summing all the numbers and dividing this calculated sum by the total number of elements. The formula for calculating the arithmetic mean is: $$ \bar{x} = \frac{1}{n} \sum_{i=1}^{n} x_i = \frac{x_1 + x_2 + x_3 + \cdots + x_n}{n} $$ Here, we are given an array of integers and our task is to calculate the arithmetic mean of these numbers using the above formula: Scenario 1 Input: num = 2, 7, 4, ... Read More

Adjust Heights of Individual Subplots in Matplotlib

Farhan Muhamed
Updated on 25-Jul-2025 17:00:06

1K+ Views

The matplotlib is a library in Python that allows us to create graphs and plots for data visualization. This library provides several functions to adjust the height, width, and other layout properties of individual subplots in a figure. In this article, we will learn how to adjust the heights of individual subplots in matplotlib using Python. Subplots in Matplotlib Adjusting Heights of Subplots Using gridspec_kw Adjusting Heights of Subplots Using GridSpec Conclusion Subplots in Matplotlib A subplot is a smaller ... Read More

Adjust Text Background Transparency in Matplotlib

Farhan Muhamed
Updated on 25-Jul-2025 16:59:45

4K+ Views

The matplotlib is a library in Python that allows us to create graphs and plots for data visualization. This library have several built-in functions to style the plots, such as changing colors, adding titles, setting backgrounds, labels, and adjusting the layout of subplots. In this article, we will learn how to adjust the transparency of text backgrounds in matplotlib plots. Text Backgrounds in Matplotlib Adjusting Background Transparency of Title Text Adjusting Background Transparency of Labels Conclusion Text Backgrounds in Matplotlib ... Read More

Array Transformation in C++

Farhan Muhamed
Updated on 25-Jul-2025 16:59:14

645 Views

Array transformation is a popular coding question asked in technical assessments and interviews. In this article, we will discuss the problem of array transformation with example testcases, the algorithm to solve it, and provide a C/C++ implementation. Array Transformation Based on Local Maxima and Minima In this problem, you are given an array of integers arr[] of size N. Every day the array undergoes a transformation which can be defined as follows: The first and last elements of the array are not transformed. For every other element arr[i] in the array, where 0 < i < N-1, ... Read More

Advertisements