Found 1862 Articles for Data Structure

Segregate Even and Odd Numbers

Simran Kumari
Updated on 23-Aug-2023 10:39:10

532 Views

What do you understand by the title `Segregate even and odd numbers` ? Let’s decode. The goal of this problem is to separate the even and odd numbers in the input array while preserving the order of the elements, which means that the even numbers should remain in the same relative order as they were in the input, and the odd numbers should remain in the same relative order as they were in the input. Suppose we have [3, 5, 2, 6, 8, 9, 10, 11] as input, then the output will be [2, 6, 8, 10, 3, 5, ... Read More

Reflection of a Point at 180-Degree Rotation of Another Point

Simran Kumari
Updated on 23-Aug-2023 10:37:13

129 Views

What do you understand by the heading `Reflection of a point at 180−degree rotation of another point`? Let’s decode it in this article. Let's assume we have two points (x1, y1) and (x2, y2) in a 2−D plane. Where (x2, y2) is the point of rotation and (x1, y1) is the point to be reflected. Now, suppose x1, y1 is rotated 180 degrees across x2, y2 , and we get x1`, y1`. Now, we can observe that, if we are given 2 points in a 2−d plane with one of the points rotating across the second point it ... Read More

Maximize a Value for a Semicircle of a given Radius

Simran Kumari
Updated on 24-Aug-2023 10:00:49

51 Views

What do understand by the question embedded in the title i.e Maximize a value for a semicircle of a given radius? The title `Maximize a value for a semicircle of a given radius` sounds unclear. Isn’t it? Let’s discuss what it means in the article below: According to the title, If we have a semicircle with radius R, we need to find the maximum value of the expression F = PS^2 + PQ, where P is a point on the circumference of the semicircle, and PQ and PS are the two segments connecting P to the two endpoints of ... Read More

Find the Maximum and Minimum Distance Between Magnets

Simran Kumari
Updated on 23-Aug-2023 10:18:35

101 Views

In this problem, we need to calculate the separation between two magnets that are attached to distinct pivots. We need to calculate the maximum and minimum distance between magnets i.e when the magnets attract and when they repel. The string's length between each magnet and the pivot is specified. Depending on their polarity, the magnets will either repel or attract one another. Calculating the distance between the two magnets when they are attracted and repelling one another is the task. Using the distance formula and taking the polarity of the magnets into account, the issue can be resolved. To calculate ... Read More

Dodecagonal Number

Simran Kumari
Updated on 23-Aug-2023 10:17:01

85 Views

What do you understand by the Dodecagonal number? In order to understand the Dodecagonal number, we first need to understand a dodecagon. What is a Dodecagon? A polygon with twelve sides and twelve angles is called a dodecagon. It is a two−dimensional geometric shape that may be created by joining twelve line segments, each of which forms a closed loop when it connects with two other segments. Every side and angle of a normal dodecagon are equal to one another. A dodecagon's interior angles add up to 180(n−2) degrees, where n is the number of sides. As a result, a ... Read More

Print the Fibonacci Sequence using 2 Variables

Simran Kumari
Updated on 23-Aug-2023 10:15:42

282 Views

What comes to your mind when reading the title? Here we need to calculate the Fibonacci sequence using only 2 variables. First, What is Fibonacci Sequence? The Fibonacci series is a set of numbers where each number is the sum of the two numbers before it. Any number after 0 and 1 is the sum of the two numbers before it. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181, 6765, 10946, ... Many fascinating mathematical features and applications of the Fibonacci series may be found in a ... Read More

Middle Term in the Binomial Expansion Series

Simran Kumari
Updated on 23-Aug-2023 10:13:51

90 Views

How can you determine the middle term in the binomial expansion series? The middle term in a binomial expansion series is determined by whether the expansion has an odd or even number of terms. The middle term is the (n+1)/2th term of the expansion if the number of terms is odd. For instance, the expansion of (a+b)^5 has 6 terms, making the middle term (5+1)/2 = 3rd term, or 10a^2b^3. There are two intermediate terms—the n/2nd and (n/2)+1th terms of the expansion—if the number of terms is even. For instance, there are 5 terms in the expansion of (a+b)^4; the ... Read More

Check if two People Starting from different Points Ever Meet

Simran Kumari
Updated on 23-Aug-2023 10:10:21

88 Views

What comes to your mind on reading the title which says `Check if two people starting from different points ever meet`? Let’s decode. We can utilize the idea of relative velocity to find whether two persons coming from different spots ever cross paths. Now, you might be aware of the term `relative velocity`. Let’s recall. The velocity of an object relative to another item or frame of reference is known as its relative velocity. It is calculated by deducting one object's velocity from another object's velocity. If two individuals are going in the same direction, their relative velocities can be ... Read More

Centered Triangular Number

Simran Kumari
Updated on 23-Aug-2023 10:06:12

134 Views

What do you understand by the term centered triangular number? Let’s decode in this article. First, what is a triangular number? A triangular arrangement of objects or dots can be used to represent a particular kind of figurate number known as a triangular number. The sum of the first n natural numbers is the nth triangular number. The first few triangular numbers, for instance, are: 1, 3, 6, 10, 15, 21 You can view these figures as triangular clusters of dots to demonstrate how they were calculated, as seen below: If you take a closer look you will ... Read More

Centered Tetrahedral Number

Simran Kumari
Updated on 23-Aug-2023 10:08:50

197 Views

What do you understand by a centered tetrahedral number? Let’s explore it in this article. Firstly, what is a tetrahedral number? A tetrahedral number is a figurate number that represents the number of spheres in a tetrahedron. It is also known as a triangular pyramid number. A tetrahedron is a three−dimensional geometric shape that has four triangular faces, six edges, and four vertices. To find the nth tetrahedral number, you can use the formula: Tn = (n * (n + 1) * (n + 2)) / 6 For example, the first few tetrahedral numbers are: 1, 4, 10, ... Read More

Advertisements