Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • DSA
  • Practice Divide and Conquer
  • MCQs on Divide and Conquer
  • Tutorial on Divide & Conquer
  • Binary Search
  • Merge Sort
  • Quick Sort
  • Calculate Power
  • Strassen's Matrix Multiplication
  • Karatsuba Algorithm
  • Divide and Conquer Optimization
  • Closest Pair of Points
Open In App
Next Article:
Optimum location of point to minimize total distance
Next article icon

Minimum Distance between Two Points

Last Updated : 29 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

You are given an array arr[] of n distinct points in a 2D plane, where each point is represented by its (x, y) coordinates. Find the minimum Euclidean distance between two distinct points.

Note: For two points A(px,qx) and B(py,qy) the distance Euclidean between them is:

Distance = [Tex]\sqrt{(p_{x}-q_{x})^{2}+ (p_{y}-q_{y})^{2}}                  [/Tex]

Examples:

Input: arr[] = [[-1, -2], [0, 0], [1, 2], [2, 3]]
Output: 1.414214
Explanation: The smallest distance is between points (1, 2) and (2, 3), which is 1.414214.

Input: arr[] = [[-2, -2], [1, 2], [-1, 0], [3, 3]]
Output: 2.236068
Explanation: The smallest distance is between points (-2, -2) and (-1, 0), which is 2.236068.

Table of Content

  • [Naive Approach] Checking All Pairs – O(n^2) Time and O(1) Space
  • [Expected Approach] Using Divide and Conquer – O(n log(n)) Time and O(n) Space

[Naive Approach] Checking All Pairs – O(n^2) Time and O(1) Space

The idea is to check the distance between all pairs of points and store the minimum distance found.

C++
// C++ program to find closet point #include <iostream> #include <vector> #include <cmath> #include <iomanip>   using namespace std;  // Function to compute Euclidean distance between two points double distance(const vector<double>& p1, const vector<double>& p2) {     return sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +                     (p1[1] - p2[1]) * (p1[1] - p2[1])); }  // Function that returns the smallest distance  // between any pair of points double minDistance(const vector<vector<double>>& points) {     int n = points.size();          double minDist = 1e9;      // Brute force to check all pairs     for (int i = 0; i < n; ++i) {         for (int j = i + 1; j < n; ++j) {             double dist = distance(points[i], points[j]);             if (dist < minDist) {                 minDist = dist;             }         }     }          // Return the smallest distance     return minDist;   }  int main() {     vector<vector<double>> points = {{-1, -2}, {0, 0}, {1, 2}, {2, 3}};      double res = minDistance(points);      cout << fixed << setprecision(6) << res << endl;      return 0; } 
Java
// Java program to find closest point import java.util.ArrayList; import java.util.List; import java.lang.Math;  class GfG {          // Function to compute Euclidean distance between two points     static double distance(double[] p1, double[] p2) {         return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +                           (p1[1] - p2[1]) * (p1[1] - p2[1]));     }      // Function that returns the smallest distance      // between any pair of points     static double minDistance(List<double[]> points) {         int n = points.size();         double minDist = Double.MAX_VALUE;          // Brute force to check all pairs         for (int i = 0; i < n; ++i) {             for (int j = i + 1; j < n; ++j) {                 double dist = distance(points.get(i), points.get(j));                 if (dist < minDist) {                     minDist = dist;                 }             }         }         // Return the smallest distance         return minDist;     }      public static void main(String[] args) {         List<double[]> points = new ArrayList<>();         points.add(new double[]{-1, -2});         points.add(new double[]{0, 0});         points.add(new double[]{1, 2});         points.add(new double[]{2, 3});          double res = minDistance(points);          System.out.printf("%.6f\n", res);     } } 
Python
# Python program to find closet point import math  # Function to compute Euclidean distance between two points def distance(p1, p2):     return math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)  # Function that returns the smallest distance # between any pair of points def minDistance(points):     n = len(points)          minDist = float('inf')        # Brute force to check all pairs     for i in range(n):         for j in range(i + 1, n):             dist = distance(points[i], points[j])             if dist < minDist:                 minDist = dist          # Return the smallest distance     return minDist  if __name__ == "__main__":     points = [[-1, -2], [0, 0], [1, 2], [2, 3]]      res = minDistance(points)      print(f"{res:.6f}") 
C#
// C# program to find closest point using System; using System.Collections.Generic;  class GfG {          // Function to compute Euclidean distance between two points     static double distance(double[] p1, double[] p2) {         return Math.Sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +                           (p1[1] - p2[1]) * (p1[1] - p2[1]));     }      // Function that returns the smallest distance     // between any pair of points     static double minDistance(List<double[]> points) {         int n = points.Count;         double minDist = double.MaxValue;          for (int i = 0; i < n; ++i) {             for (int j = i + 1; j < n; ++j) {                 double dist = distance(points[i], points[j]);                 if (dist < minDist) {                     minDist = dist;                 }             }         }                  // Return the smallest distance         return minDist;     }      static void Main() {         List<double[]> points = new List<double[]> {             new double[] {-1, -2},             new double[] {0, 0},             new double[] {1, 2},             new double[] {2, 3}         };          double res = minDistance(points);          Console.WriteLine(res.ToString("F6"));     } } 
JavaScript
// JavaScript program to find closest point  // Function to compute Euclidean distance between two points function distance(p1, p2) {     return Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2); }  // Function that returns the smallest distance // between any pair of points function minDistance(points) {     let n = points.length;     let minDist = Infinity;      for (let i = 0; i < n; ++i) {         for (let j = i + 1; j < n; ++j) {             let dist = distance(points[i], points[j]);             if (dist < minDist) {                 minDist = dist;             }         }     }          // Return the smallest distance     return minDist; }  // Driver Code const points = [[-1, -2], [0, 0], [1, 2], [2, 3]]; const res = minDistance(points);  console.log(res.toFixed(6)); 

Output
1.414214 

[Expected Approach] Using Divide and Conquer – O(n log(n)) Time and O(n) Space

The main idea is to use the divide and conquer algorithm, where the points are recursively divided into smaller groups. The minimum distance is calculated within each groups, and during the merging step, we will check for possible closer pairs across the dividing point. This approach reduces the number of comparisons, as it only focuses on relevant points near the divide.

Step By Step Implementation:

  • Sort the points by x-coordinate.
  • Recursively divide the points into left and right subarrays until each subarrays has one or two points:
    • If one point, return infinity.
    • If two points, return their distance.
  • Find the minimum distances dl and dr in the left and right subarrays, and set d as the smaller value between dl and dr.


  • Build a strip: collect points whose x-distance from the midline is ≤ d.


  • Sort the strip by y-coordinate.
  • For each point in the strip, compare it with the next up to 7 points (having y-distance ≤ d) to check for closer pairs.
  • Update d if a smaller distance is found in the strip.
  • Return the smallest distance found from the left half, right half, or across the strip.

Key Insights:

Let the dividing point be at coordinate (x, y). After recursively finding the minimum distance d from the left and right halves, we focus on points near the dividing point that could potentially form a closer pair.

We stores all points whose x-distance from the dividing point is ≤ d, i.e., points between x - d and x + d. So, all these points lie inside a vertical strip of width 2d along the x-axis.

  • Why only consider points within x - d to x + d?
  • If two points lie farther than d apart in the x-direction, their distance is already greater than d, so they can’t be closer.

Now, to reduce unnecessary comparisons, we sort these points by their y-coordinate. For each point in this strip, we only compare it with points that are within d units vertically (i.e., y-distance ≤ d).

  • Why compare points with y distance ≤ d?
  • Because any pair with a y-distance > d will have a total distance > d, so we can safely skip those.

This means for any point in the strip[], we’re only checking points inside a rectangle of dimensions 2d × d (width 2d along x, height d along y).

For each point in the strip[], we check at most 7 points, as there are at most 7 points within this rectangle that could potentially have a smaller distance.

  • Why at most 7 comparisons per point in strip[]?

Let’s look at this 2d × d rectangle more closely:

  • Split it into two d × d squares: one for points from the left half, one for the right half.
  • Each square is then divided into 4 smaller squares of size (d/2 × d/2).
  • The diagonal of these smaller squares is less than d/√2 which is less than d, so no two points can occupy the same small square (otherwise, they’d be closer than d, violating the earlier recursive result).
  • So, each d × d square can have at most 4 points, totaling at most 8 points in the full 2d × d rectangle.

Since we’re only comparing the current point with the others, that means at most 7 valid comparisons.

C++
// C++ program to find minimum distance between points  #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <iomanip>  using namespace std;  // Function to compute Euclidean distance between two points double distance(const vector<double>& p1, const vector<double>& p2) {     return sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +                 (p1[1] - p2[1]) * (p1[1] - p2[1])); }  // Comparison function to sort points by x-coordinate bool compareX(const vector<double>& p1, const vector<double>& p2) {     return p1[0] < p2[0]; }  // Comparison function to sort points by y-coordinate bool compareY(const vector<double>& p1, const vector<double>& p2) {     return p1[1] < p2[1]; }  // Function to find the minimum distance in the strip double stripClosest(vector<vector<double>>& strip, double d) {     double minDist = d;      // Sort points in the strip by their y-coordinate     sort(strip.begin(), strip.end(), compareY);      // Compare each point in the strip     for (int i = 0; i < strip.size(); ++i) {                  // At most 7 times this will run         for (int j = i + 1; j < strip.size() &&                     (strip[j][1] - strip[i][1]) < minDist; ++j) {             minDist = min(minDist, distance(strip[i], strip[j]));         }     }      return minDist; }  // Divide and conquer function to find the minimum distance double minDistUtil(vector<vector<double>>& points,                                  int left, int right) {                                 // Base case brute force for 2 or fewer points     if (right - left <= 2) {         double minDist = 1e9;         for (int i = left; i < right; ++i) {             for (int j = i + 1; j < right; ++j) {                 minDist = min(minDist, distance(points[i], points[j]));             }         }         return minDist;     }      // Find the midpoint     int mid = (left + right) / 2;     double midX = points[mid][0];      // Recursively find the minimum distances in     // the left and right halves     double dl = minDistUtil(points, left, mid);     double dr = minDistUtil(points, mid, right);      double d = min(dl, dr);      // Build the strip of points within distance d from the midline     int k = 0;     vector<vector<double>> strip;     for (int i = left; i < right; ++i) {         if (abs(points[i][0] - midX) < d) {             strip.push_back(points[i]);         }     }      // Find the minimum distance in the strip     double stripDist = stripClosest(strip, d);      return min(d, stripDist); }  // Function to find the closest pair of points double minDistance(vector<vector<double>>& points) {     int n = points.size();      // Sort points by x-coordinate     sort(points.begin(), points.end(), compareX);      return minDistUtil(points, 0, n); }  int main() {     vector<vector<double>> points = {{-1, -2}, {0, 0}, {1, 2}, {2, 3}};      double res = minDistance(points);      // Output the result with 6 decimal places     cout << fixed << setprecision(6) << res << endl;      return 0; } 
Java
// Java program to find minimum distance between points  import java.util.*; import java.lang.Math;  public class GfG{          // Function to compute Euclidean distance between two points     static double distance(double[] p1, double[] p2) {         return Math.sqrt((p1[0] - p2[0]) * (p1[0] - p2[0]) +                           (p1[1] - p2[1]) * (p1[1] - p2[1]));     }      // Comparison function to sort points by x-coordinate     static Comparator<double[]> compareX = new Comparator<double[]>() {         public int compare(double[] p1, double[] p2) {             return Double.compare(p1[0], p2[0]);         }     };      // Comparison function to sort points by y-coordinate     static Comparator<double[]> compareY = new Comparator<double[]>() {         public int compare(double[] p1, double[] p2) {             return Double.compare(p1[1], p2[1]);         }     };      // Function to find the minimum distance in the strip     static double stripClosest(double[][] strip, double d) {         double minDist = d;          // Sort points in the strip by their y-coordinate         Arrays.sort(strip, compareY);          // Compare each point in the strip         for (int i = 0; i < strip.length; i++) {             for (int j = i + 1; j < strip.length && (strip[j][1] - strip[i][1]) < minDist; j++) {                 minDist = Math.min(minDist, distance(strip[i], strip[j]));             }         }          return minDist;     }      // Divide and conquer function to find the minimum distance     static double minDistUtil(double[][] points, int left, int right) {                  // Base case brute force for 2 or fewer points         if (right - left <= 2) {             double minDist = Double.MAX_VALUE;             for (int i = left; i < right; i++) {                 for (int j = i + 1; j < right; j++) {                     minDist = Math.min(minDist, distance(points[i], points[j]));                 }             }             return minDist;         }          // Find the midpoint         int mid = (left + right) / 2;         double midX = points[mid][0];          // Recursively find the minimum distances in         // the left and right halves         double dl = minDistUtil(points, left, mid);         double dr = minDistUtil(points, mid, right);          double d = Math.min(dl, dr);          // Build the strip of points within distance d from the midline         List<double[]> strip = new ArrayList<>();         for (int i = left; i < right; i++) {             if (Math.abs(points[i][0] - midX) < d) {                 strip.add(points[i]);             }         }          // Find the minimum distance in the strip         double stripDist = stripClosest(strip.toArray(new double[strip.size()][]), d);          return Math.min(d, stripDist);     }      // Function to find the closest pair of points     static double minDistance(double[][] points) {         int n = points.length;          // Sort points by x-coordinate         Arrays.sort(points, compareX);          return minDistUtil(points, 0, n);     }      public static void main(String[] args) {         double[][] points = {{-1, -2}, {0, 0}, {1, 2}, {2, 3}};          double res = minDistance(points);          // Output the result with 6 decimal places         System.out.printf("%.6f\n", res);     } } 
Python
# Python program to find minimum distance between points  import math  # Function to compute Euclidean distance between two points def distance(p1, p2):     return math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2)  # Function to find the minimum distance in the strip def stripClosest(strip, d):     min_dist = d      # Sort points in the strip by their y-coordinate     strip.sort(key=lambda point: point[1])      # Compare each point in the strip     for i in range(len(strip)):         for j in range(i + 1, len(strip)):             if (strip[j][1] - strip[i][1]) < min_dist:                 min_dist = min(min_dist, distance(strip[i], strip[j]))             else:                 break      return min_dist  # Divide and conquer function to find the minimum distance def minDistUtil(points, left, right):          # Base case brute force for 2 or fewer points     if right - left <= 2:         min_dist = float('inf')         for i in range(left, right):             for j in range(i + 1, right):                 min_dist = min(min_dist, distance(points[i], points[j]))         return min_dist      # Find the midpoint     mid = (left + right) // 2     mid_x = points[mid][0]      # Recursively find the minimum distances     # in the left and right halves     dl = minDistUtil(points, left, mid)     dr = minDistUtil(points, mid, right)      d = min(dl, dr)      # Build the strip of points within distance d from the midl     strip = []     for i in range(left, right):         if abs(points[i][0] - mid_x) < d:             strip.append(points[i])      # Find the minimum distance in the strip     stripDist = stripClosest(strip, d)      return min(d, stripDist)  # Function to find the closest pair of points def minDistance(points):     n = len(points)      # Sort points by x-coordinate     points.sort(key=lambda point: point[0])      return minDistUtil(points, 0, n)  if __name__ == '__main__':     points = [[-1, -2], [0, 0], [1, 2], [2, 3]]      res = minDistance(points)      # Output the result with 6 decimal places     print(f'{res:.6f}') 
C#
// C# program to find minimum distance between points  using System; using System.Linq; using static System.Math; using System.Collections.Generic;  class GfG {          // Function to compute Euclidean distance between two points     static double distance(double[] p1, double[] p2){         double dx = p1[0] - p2[0];         double dy = p1[1] - p2[1];         return Sqrt(dx * dx + dy * dy);     }      // Function to find the minimum distance in the strip     static double stripClosest(double[][] strip, double d){         double minDist = d;          // Sort points in the strip by their y-coordinate         Array.Sort(strip, (p1, p2) => p1[1].CompareTo(p2[1]));          for (int i = 0; i < strip.Length; ++i){                          // The inner loop runs for at most 7 points             for (int j = i + 1; j < strip.Length &&                     (strip[j][1] - strip[i][1]) < minDist; ++j){                 minDist = Min(minDist, distance(strip[i], strip[j]));             }         }          return minDist;     }      // Divide and conquer function to find the minimum distance     static double minDistUtil(double[][] points, int left, int right){                  // Base case there are 2 or fewer points         if (right - left <= 2){              if (right - left <= 0) return double.MaxValue;             return distance(points[left], points[right - 1]);         }           // Find the midpoint index         int midIndex = left + (right - left) / 2;         double midX = points[midIndex][0];          // Recursively find the minimum distances         // in the left and right halves         double dl = minDistUtil(points, left, midIndex);         double dr = minDistUtil(points, midIndex, right);          double d = Min(dl, dr);          // Build the strip of points whose x-coordinate          // is within distance 'd' from the mid         List<double[]> stripList = new List<double[]>();         for (int i = left; i < right; ++i){             if (Abs(points[i][0] - midX) < d){                 stripList.Add(points[i]);             }         }          double[][] stripArray = stripList.ToArray();          // Find the minimum distance in the strip         double stripDist = stripClosest(stripArray, d);          return Min(d, stripDist);     }      // Function to find the closest pair of points     static double minDistance(double[,] points2D){         int n = points2D.GetLength(0);          double[][] points = new double[n][];         for (int i = 0; i < n; i++){             points[i] = new double[] { points2D[i, 0], points2D[i, 1] };         }          // Sort points by x-coordinate         Array.Sort(points, (p1, p2) => p1[0].CompareTo(p2[0]));          return minDistUtil(points, 0, n);     }      static void Main(){         double[,] points = {             { -1, -2 },             { 0, 0 },             { 1, 2 },             { 2, 3 },             { 5, 1 },             { 6, 3 },             { 8, 0 },             { 9, 2 }         };          double res = minDistance(points);          // Output the result with 6 decimal places         Console.WriteLine(res.ToString("F6"));     } } 
JavaScript
// JavaScript program to find minimum distance between points  // Function to compute Euclidean distance between two points function distance(p1, p2) {     return Math.sqrt((p1[0] - p2[0]) ** 2 + (p1[1] - p2[1]) ** 2); }  // Comparison function to sort points by x-coordinate function compareX(p1, p2) {     return p1[0] - p2[0]; }  // Comparison function to sort points by y-coordinate function compareY(p1, p2) {     return p1[1] - p2[1]; }  // Function to find the minimum distance in the strip function stripClosest(strip, d) {     let minDist = d;      // Sort points in the strip by their y-coordinate     strip.sort(compareY);      // Compare each point in the strip     for (let i = 0; i < strip.length; i++) {         // At most 7 times this will run         for (let j = i + 1; j < strip.length &&                      (strip[j][1] - strip[i][1]) < minDist; j++) {             minDist = Math.min(minDist, distance(strip[i], strip[j]));         }     }      return minDist; }  // Divide and conquer function to find the minimum distance function minDistUtil(points, left, right) {          // Base case brute force for 2 or fewer points     if (right - left <= 2) {         let minDist = Infinity;         for (let i = left; i < right; i++) {             for (let j = i + 1; j < right; j++) {                 minDist = Math.min(minDist, distance(points[i], points[j]));             }         }         return minDist;     }      // Find the midpoint     let mid = Math.floor((left + right) / 2);     let midX = points[mid][0];      // Recursively find the minimum distances in the left and right halves     let dl = minDistUtil(points, left, mid);     let dr = minDistUtil(points, mid, right);      let d = Math.min(dl, dr);      // Build the strip of points within distance d from the midline     let strip = [];     for (let i = left; i < right; i++) {         if (Math.abs(points[i][0] - midX) < d) {             strip.push(points[i]);         }     }      // Find the minimum distance in the strip     let stripDist = stripClosest(strip, d);      return Math.min(d, stripDist); }  // Function to find the closest pair of points function minDistance(points) {     let n = points.length;      // Sort points by x-coordinate     points.sort(compareX);      return minDistUtil(points, 0, n); }  // Driver Code let points = [[-1, -2], [0, 0], [1, 2], [2, 3]];  let res = minDistance(points);  // Output the result with 6 decimal places console.log(res.toFixed(6)); 

Output
1.414214 

Applications: 

  • Used to detect planes that are too close to each other, preventing potential collisions.
  • Used in motion planning to avoid obstacles by determining the closest obstacles or points in the robot’s path.
  • Helps in data classification and pattern recognition by finding nearest data points for training models.
  • Optimizing the placement of devices by finding nearest neighbors for improved communication.


Next Article
Optimum location of point to minimize total distance
author
kartik
Improve
Article Tags :
  • Divide and Conquer
  • DSA
  • Geometric
  • Closest Pair of Points
Practice Tags :
  • Divide and Conquer
  • Geometric

Similar Reads

  • Geometric Algorithms
    Geometric algorithms are a type of algorithm that deal with solving problems related to geometry. These algorithms are used to solve various geometric problems such as computing the area of a polygon, finding the intersection of geometric shapes, determining the convex hull of a set of points, and m
    4 min read
  • Problems based on Pattern Printing

    • Print lower triangle with alternate '*' and '#'
      Given a number N which denotes the number of rows, the task is to follow the below pattern to print the first N rows of it. Pattern: **#*#**#*#*#*#* Examples: Input: N = 2Output:**# Input: N = 6Output: **#*#**#*#*#*#**#*#*# Approach: Follow the below steps to implement the above pattern: Initialize
      4 min read

    • Print the pattern 1*2*5*6 --3*4
      Given integer N, the task is to print an upside-down triangle where the left half is made of elements in the range [1, N*(N+1)/2] and the right half is made of elements in the range [N*(N+1)/2 + 1, N*(N+1)]. Examples: Input: N = 3 Output: 1*2*3*10*11*12 4*5*8*9 6*7 Input: n = 4Output:1*2*3*4*17*18*1
      6 min read

    • Python Program to print the pattern 'G'
      In this article, we will learn how to print the pattern G using stars and white-spaces. Given a number n, we will write a program to print the pattern G over n lines or rows. Examples: Input : 7Output : *** * * * *** * * * * *** Input : 9Output : ***** * * * * *** * * * * * * ***** In this program,
      2 min read

    • Program to Print Pascal's Triangle
      Given an integer n, the task is to find the first n rows of Pascal's triangle. Pascal's triangle is a triangular array of binomial coefficients. Examples: Example1: The below image shows the Pascal's Triangle for n=4 Example2: The below image shows the Pascal's Triangle for n = 6 Table of Content [N
      15 min read

    • Program to print pyramid pattern
      Write to program to print the pyramid pattern formed of stars Example : Input: n = 6 Output: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * We strongly recommend you to minimize your browser and try this yourself first.The idea is to use two for loops for every part of the p
      5 min read

    • Program to print the Diamond Shape
      Given a number n, write a program to print a diamond shape with 2n rows. Examples : [GFGTABS] C++ // C++ program to print diamond shape // with 2n rows #include <bits/stdc++.h> using namespace std; // Prints diamond pattern with 2n rows void printDiamond(int n) { int space = n - 1; // run loop
      11 min read

    • Hour-glass Pattern
      Given positive integer n, print numeric pattern in form of an hourglass.Examples : Input : rows_no = 7 Output : 1 2 3 4 5 6 7 2 3 4 5 6 7 3 4 5 6 7 4 5 6 7 5 6 7 6 7 7 6 7 5 6 7 4 5 6 7 3 4 5 6 7 2 3 4 5 6 7 1 2 3 4 5 6 7 C/C++ Code // CPP code for hour glass // pattern. #include <iostream> us
      7 min read

    • Program to print V and inverted-V pattern
      Inverted V pattern: Given the value of n, print the inverted V pattern.Examples : Input : n = 5 Output : E D D C C B B A A Input : n = 7 Output : G F F E E D D C C B B A A Below is the program to print the above pattern C/C++ Code // C++ Implementation to print the pattern #include <bits/stdc++.h
      8 min read

    • Program to print hollow pyramid, diamond pattern and their modifications
      For Prerequisite : Loops, If Else Statement1. Hollow pyramid/triangle pattern The pattern is similar to pyramid pattern. The only difference is, we will replace all internal '#' or '*' characters by space character and we will print 2*N-1 (N = number of rows in pattern) '#' or '*' characters in last
      15+ min read

    • Code to Generate the Map of India (With Explanation)
      Given an obfuscated code that generates the map of India, explain its working. The following code when executed generates the map of India. An obfuscated code is a code that has been deliberately made difficult to understand or difficult to read, typically for the purpose of hiding its logic or maki
      8 min read

    Problems based on Lines

    • How to check if two given line segments intersect?
      Given two line segments represented as a 3D vector points[][][], where each line segment i is defined by its endpoints stored in points[i][0] and points[i][1] (each containing 2 integers), your task is to determine if these two line segments intersect with each other. Examples: Input: points[][][] =
      10 min read

    • Sweep Line Algorithm - Find if any Two Segments Intersect
      Given n line segments represented as a 3D vector points[][][], where each line segment i is defined by its endpoints stored in points[i][0] and points[i][1] (each containing 2 integers), your task is to determine if any two of these line segments intersect and find the number of intersection points.
      15+ min read

    • Klee's Algorithm (Length Of Union Of Segments of a line)
      Given starting and ending positions of segments on a line, the task is to take the union of all given segments and find length covered by these segments.Examples: Input : segments[] = {{2, 5}, {4, 8}, {9, 12}} Output : 9 Explanation: segment 1 = {2, 5} segment 2 = {4, 8} segment 3 = {9, 12} If we ta
      9 min read

    • Count maximum points on same line
      Given N point on a 2D plane as pair of (x, y) co-ordinates, we need to find maximum number of point which lie on the same line. Examples: Input : points[] = {-1, 1}, {0, 0}, {1, 1}, {2, 2}, {3, 3}, {3, 4} Output : 4 Then maximum number of point which lie on same line are 4, those point are {0, 0}, {
      10 min read

    • Minimum lines to cover all points
      Given N points in 2-dimensional space, we need to print the count of the minimum number of lines which traverse through all these N points and which go through a specific (xO, yO) point also.Examples: If given points are (-1, 3), (4, 3), (2, 1), (-1, -2), (3, -3) and (xO, yO) point is (1, 0) i.e. ev
      9 min read

    • Represent a given set of points by the best possible straight line
      Find the value of m and c such that a straight line y = mx + c, best represents the equation of a given set of points (x[Tex]_1 [/Tex], y[Tex]_1 [/Tex]), (x[Tex]_2 [/Tex], y[Tex]_2 [/Tex]), (x[Tex]_3 [/Tex], y[Tex]_3 [/Tex]), ......., (x[Tex]_n [/Tex], y[Tex]_n [/Tex]), given n >=2. Examples: Inp
      10 min read

    • Program to find line passing through 2 Points
      Given two points P and Q in the coordinate plane, find the equation of the line passing through both points.This kind of conversion is very useful in many geometric algorithms like intersection of lines, finding the circumcenter of a triangle, finding the incenter of a triangle and many more... Exam
      6 min read

    • Reflection of a point about a line in C++
      Let’s first consider a general case where the line is nothing but the X-Axis. We can now definitely say that the conjugate of a point is the reflection of the point about X-Axis.Now, using the methods of translation and rotation of coordinate axes we will find out the reflection of a point about the
      4 min read

    • Program to find the mid-point of a line
      Given two coordinates of a line starting is (x1,y1) and ending is (x2,y2) find out the mid-point of a line. Examples : Input : x1 = –1, y1 = 2, x2 = 3, y2 = –6 Output : 1,–2 Input : x1 = 6.4, y1 = 3 x2 = –10.7, y2 = 4 Output : –2.15, 3.5 The Midpoint Formula: The midpoint of two points, (x1, y2) and
      3 min read

    • Sum of Manhattan distances between all pairs of points
      Given n integer coordinates. The task is to find the sum of the Manhattan distance between all pairs of coordinates. Manhattan Distance between (x1, y1) and (x2, y2) is: |x1 - x2| + |y1 - y2| Examples : Input : n = 4, p1 = { -1, 5 }, p2 = { 1, 6 }, p3 = { 3, 5 }, p4 = { 2, 3 }Output : 22Explanation
      9 min read

    • Program to check if three points are collinear
      Given three points, check whether they lie on a straight (collinear) or notExamples : Input : (1, 1), (1, 4), (1, 5) Output : Yes The points lie on a straight line Input : (1, 5), (2, 5), (4, 6) Output : No The points do not lie on a straight line First approach Three points lie on the straight line
      10 min read

    Problems based on Triangles

    • Check whether a given point lies inside a triangle or not
      Given three corner points of a triangle, and one more point P. Write a function to check whether P lies within the triangle or not. Example: Input: A = (0, 0), B = (10, 30), C = (20, 0), P(10, 15)Output: InsideExplanation: B(10,30) / \ / \ / \ / P \ P' / \ A(0,0) ----------- C(20,0) Input: A = (0, 0
      15+ min read

    • Program to find area of a triangle
      Given the sides of a triangle, the task is to find the area of this triangle. Examples : Input : a = 5, b = 7, c = 8 Output : Area of a triangle is 17.320508 Input : a = 3, b = 4, c = 5 Output : Area of a triangle is 6.000000Recommended PracticeArea of a triangleTry It! Approach: The area of a trian
      10 min read

    • Count Integral points inside a Triangle
      Given three non-collinear integral points in XY plane, find the number of integral points inside the triangle formed by the three points. (A point in XY plane is said to be integral/lattice point if both its co-ordinates are integral). Example: Input: p = (0, 0), q = (0, 5) and r = (5,0) Output: 6Ex
      8 min read

    • Maximum number of 2x2 squares that can be fit inside a right isosceles triangle
      What is the maximum number of squares of size 2x2 units that can be fit in a right-angled isosceles triangle of a given base (in units). A side of the square must be parallel to the base of the triangle. Examples: Input : 8Output : 6Explanation: We get total 6 squares ( 1 + 2 + 3). Please refer the
      3 min read

    • Find all angles of a given triangle
      Given coordinates of all three vertices of the triangle in the 2D plane, the task is to find all three angles.Example: Input : A = (0, 0), B = (0, 1), C = (1, 0) Output : 90, 45, 45 To solve this problem we use below Law of cosines. c^2 = a^2 + b^2 - 2(a)(b)(cos beta) After re-arranging beta = acos(
      7 min read

    • Check if right triangle possible from given area and hypotenuse
      Given area and hypotenuse, the aim is to print all sides if right triangle can exist, else print -1. We need to print all sides in ascending order. Examples: Input : 6 5 Output : 3 4 5 Input : 10 6 Output : -1 We have discussed a solution of this problem in below post. Find all sides of a right angl
      6 min read

    • Number of Triangles that can be formed given a set of lines in Euclidean Plane
      Given a set L = {l1, l2, ……..., ln} of ‘n’ distinct lines on the Euclidean Plane. The ith line is given by an equation in the form aix + biy = ci. Find the number of triangles that can be formed using the lines in the set L. Note that no two pairs of lines intersect at the same point. Note: This pro
      13 min read

    • Program to calculate area of Circumcircle of an Equilateral Triangle
      Given the length of sides of an equilateral triangle. We need to write a program to find the area of Circumcircle of the given equilateral triangle.Examples: Input : side = 6 Output : Area of circumscribed circle is: 37.69 Input : side = 9 Output : Area of circumscribed circle is: 84.82 All three si
      4 min read

    • Program to calculate area and perimeter of equilateral triangle
      An equilateral triangle is a triangle in which all three sides and angles are equal. All three internal angles of equilateral triangle measures 60 degree. If we know the length of each sides of equilateral triangle, then we can use below mentioned formula to calculate area of equilateral triangle.Ar
      4 min read

    • Minimum height of a triangle with given base and area
      Given two integers a and b, find the smallest possible height such that a triangle of at least area "a" and base "b" can be formed. Examples:  Input : a = 2, b = 2Output : Minimum height of triangle is 2Explanation: Input : a = 8, b = 4Output : Minimum height of triangle is 4Minimum height of Triang
      5 min read

    Problems based on Rectangle, Square and Circle

    • Find if two rectangles overlap
      Given two rectangles, find if the given two rectangles overlap or not.Note that a rectangle can be represented by two coordinates, top left and bottom right. So mainly we are given following four coordinates. l1: Top Left coordinate of first rectangle. r1: Bottom Right coordinate of first rectangle.
      5 min read

    • Check if four segments form a rectangle
      We are given four segments as a pair of coordinates of their end points. We need to tell whether those four line segments make a rectangle or not. Examples: Input : segments[] = [(4, 2), (7, 5), (2, 4), (4, 2), (2, 4), (5, 7), (5, 7), (7, 5)] Output : Yes Given these segment make a rectangle of leng
      9 min read

    • Minimum Perimeter of n blocks
      We are given n blocks of size 1 x 1, we need to find the minimum perimeter of the grid made by these blocks.Examples : Input : n = 4Output : 8Minimum possible perimeter with 4 blocksis 8. See below explanation.Input : n = 11Output : 14The square grid of above examples would be as Let us take an exam
      5 min read

    • Number of rectangles in N*M grid
      We are given a N*M grid, print the number of rectangles in it.Examples: Input : N = 2, M = 2Output : 9There are 4 rectangles of size 1 x 1.There are 2 rectangles of size 1 x 2There are 2 rectangles of size 2 x 1There is one rectangle of size 2 x 2.Input : N = 5, M = 4Output : 150Input : N = 4, M = 3
      7 min read

    • Coordinates of rectangle with given points lie inside
      Given two arrays X[] and Y[] with n-elements, where (Xi, Yi) represent a point on coordinate system, find the smallest rectangle such that all points from given input lie inside that rectangle and sides of rectangle must be parallel to Coordinate axis. Print all four coordinates of an obtained recta
      6 min read

    • Program for Area Of Square
      A square is a flat shape, in one plane, defined by four points at the four corners. A square has four sides all of equal length, and four corners, all right angles (90 degree angles). A square is a kind of rectangle. Examples : Input : 4 Output :16 Input :8 Output :64 Formula [Tex]Area = side*side [
      2 min read

    • Circle and Lattice Points
      Given a circle of radius r in 2-D with origin or (0, 0) as center. The task is to find the total lattice points on circumference. Lattice Points are points with coordinates as integers in 2-D space.Example: Input : r = 5.Output : 12Below are lattice points on a circle withradius 5 and origin as (0,
      6 min read

    • Pizza cut problem (Or Circle Division by Lines)
      Given number of cuts, find the maximum number of possible pieces.Examples: Input : 2 Output : 4 Input : 3 Output : 7 This problem is nothing but The Lazy Caterer’s Problem and has below formula.Maximum number of pieces = 1 + n*(n+1)/2Refer this for proof. C/C++ Code // C++ program to find maximum no
      3 min read

    • Angular Sweep (Maximum points that can be enclosed in a circle of given radius)
      Given ‘n’ points on the 2-D plane, find the maximum number of points that can be enclosed by a fixed-radius circle of radius ‘R’. Note: The point is considered to be inside the circle even when it lies on the circumference. Examples:  Input: R = 1 points[] = {(6.47634, 7.69628), (5.16828 4.79915), (
      15 min read

    • Check if a line touches or intersects a circle
      Given coordinate of the center and radius > 1 of a circle and the equation of a line. The task is to check if the given line collides with the circle or not. There are three possibilities : Line intersects the circle.Line touches the circle.Line is outside the circle Note: General equation of a l
      6 min read

    • Area of a Circumscribed Circle of a Square
      Given the side of a square then find the area of a Circumscribed circle around it.Examples: Input : a = 6 Output : Area of a circumscribed circle is : 56.55 Input : a = 4 Output : Area of a circumscribed circle is : 25.13 All four sides of a square are of equal length and all four angles are 90 degr
      3 min read

    • Area of square Circumscribed by Circle
      Given the radius(r) of circle then find the area of square which is Circumscribed by circle.Examples: Input : r = 3Output :Area of square = 18Input :r = 6Output :Area of square = 72 All four sides of a square are of equal length and all four angles are 90 degree. The circle is circumscribed on a giv
      4 min read

    • Program to find area of a Circular Segment
      In a circle, if a chord is drawn then that chord divides the whole circle into two parts. These two parts of the circle are called segments of the circle. The smaller area is known as the Minor segment and the larger area is called as the Major segment.In the figure below, the chord AB divides the c
      6 min read

    • Arc length from given Angle
      An angle is a geometrical figure when two rays meet at a common point on a plane. These rays form the sides of the angle and the meeting point is referred as the vertex of the angle. There is something that we need to keep in mind that the plane that forms an angle doesn't need to be a Euclidean pla
      4 min read

    • Program to find Circumference of a Circle
      Given radius of a circle, write a program to find its circumference.Examples : Input : 2 Output : Circumference = 12.566 Input : 8 Output : Circumference = 50.264 In a circle, points lie in the boundary of a circle are at same distance from its center. This distance is called radius. Circumference o
      3 min read

    • Check if two given circles touch or intersect each other
      There are two circles A and B with their centres C1(x1, y1) and C2(x2, y2) and radius R1 and R2. The task is to check both circles A and B touch each other or not. Examples : Input : C1 = (3, 4) C2 = (14, 18) R1 = 5, R2 = 8Output : Circles do not touch each other. Input : C1 = (2, 3) C2 = (15, 28) R
      5 min read

    Problems based on 3D Objects

    • Find the perimeter of a cylinder
      Given diameter and height, find the perimeter of a cylinder.Perimeter is the length of the outline of a two - dimensional shape. A cylinder is a three - dimensional shape. So, technically we cannot find the perimeter of a cylinder but we can find the perimeter of the cross-section of the cylinder. T
      3 min read

    • Find the Surface area of a 3D figure
      Given a N*M matrix A[][] representing a 3D figure. The height of the building at [Tex](i, j) [/Tex]is [Tex]A[i][j] [/Tex]. Find the surface area of the figure. Examples : Input : N = 1, M = 1 A[][] = { {1} } Output : 6 Explanation : The total surface area is 6 i.e 6 side of the figure and each are o
      12 min read

    • Calculate Volume of Dodecahedron
      Given the edge of the dodecahedron calculate its Volume. Volume is the amount of the space which the shapes takes up. A dodecahedron is a 3-dimensional figure made up of 12 faces, or flat sides. All of the faces are pentagons of the same size.The word 'dodecahedron' comes from the Greek words dodeca
      3 min read

    • Program to calculate volume of Octahedron
      Given the side of the Octahedron then calculate the volume of Octahedron. Examples: Input : 3 Output : 12.7279 Input : 7 Output : 161.692 Approach: The volume of an octahedron is given by the formula: Volume = √2/3 × a3 where a is the side of Octahedron Below is the implementation to calculate volum
      2 min read

    • Program to calculate Volume and Surface area of Hemisphere
      Calculate volume and surface area of a hemisphere. Hemisphere : In geometry, it is an exact half of a sphere. We can find many of the real life examples of the hemispheres such as our planet Earth can be divided into two hemisphere the southern & northern hemispheres.   Volume of Hemisphere : Vo
      4 min read

    • Program for volume of Pyramid
      A pyramid is a 3-dimensional geometric shape formed by connecting all the corners of a polygon to a central apex. There are many types of pyramids. Most often, they are named after the type of base they have. Let's look at some common types of pyramids below. Volume of a square pyramid [base of Pyra
      7 min read

    • Program to calculate volume of Ellipsoid
      Ellipsoid, closed surface of which all plane cross sections are either ellipses or circles. An ellipsoid is symmetrical about three mutually perpendicular axes that intersect at the center. It is a three-dimensional, closed geometric shape, all planar sections of which are ellipses or circles. An el
      4 min read

    • Program for Volume and Surface Area of Cube
      Cube is a 3-dimensional box-like figure represented in the 3-dimensional plane. Cube has 6 squared-shape equal faces. Each face meet another face at 90 degree each. Three sides of cube meet at same vertex. Examples: Input : Side of a cube = 2 Output : Area = 8 Total surface area = 24 Input : Side of
      3 min read

    Problems based on Quadrilateral

    • Number of parallelograms when n horizontal parallel lines intersect m vertical parallel lines
      Given two positive integers n and m. The task is to count number of parallelogram that can be formed of any size when n horizontal parallel lines intersect with m vertical parallel lines. Examples: Input : n = 3, m = 2Output : 32 parallelograms of size 1x1 and 1 parallelogram of size 2x1.Input : n =
      8 min read

    • Program for Circumference of a Parallelogram
      Given the sides of Parallelogram then calculate the circumference.Examples : Input: a = 10, b = 8 Output: 36.00 Input: a = 25.12, b = 20.4 Output: 91.04 The opposite sides of a parallelogram are of equal length and parallel. The angles are pairwise equal but not necessarily 90 degree. The circumfere
      3 min read

    • Program to calculate area and perimeter of Trapezium
      A trapezium is a quadrilateral with at least one pair of parallel sides, other two sides may not be parallel. The parallel sides are called the bases of the trapezium and the other two sides are called it's legs. The perpendicular distance between parallel sides is called height of trapezium. Formul
      5 min read

    • Program to find area of a Trapezoid
      Definition of Trapezoid : A Trapezoid is a convex quadrilateral with at least one pair of parallel sides. The parallel sides are called the bases of the trapezoid and the other two sides which are not parallel are referred to as the legs. There can also be two pairs of bases. In the above figure CD
      4 min read

    • Find all possible coordinates of parallelogram
      Find all the possible coordinates from the three coordinates to make a parallelogram of a non-zero area.Let's call A, B, and C are the three given points. We can have only the three possible situations:  (1) AB and AC are sides, and BC a diagonal(2) AB and BC are sides, and AC a diagonal (3) BC and
      5 min read

    • Maximum area of quadrilateral
      Given four sides of quadrilateral a, b, c, d, find the maximum area of the quadrilateral possible from the given sides .Examples:   Input : 1 2 1 2Output : 2.00It is optimal to construct a rectangle for maximum area .     According to Bretschneider's formula, the area of a general quadrilateral is g
      5 min read

    • Check whether four points make a parallelogram
      Given four points in a 2-dimensional space we need to find out whether they make a parallelogram or not. A parallelogram has four sides. Two opposite sides are parallel and are of same lengths. Examples: Points = [(0, 0), (4, 0), (1, 3), (5, 3)]Above points make a parallelogram.Points = [(0, 0), (2,
      15+ min read

    • Find the Missing Point of Parallelogram
      Given three coordinate points A, B and C, find the missing point D such that ABCD can be a parallelogram.Examples : Input : A = (1, 0) B = (1, 1) C = (0, 1) Output : 0, 0 Explanation: The three input points form a unit square with the point (0, 0) Input : A = (5, 0) B = (1, 1) C = (2, 5) Output : 6,
      13 min read

    Problems based on Polygon and Convex Hull

    • How to check if a given point lies inside or outside a polygon?
      Given a polygon and a point 'p', find if 'p' lies inside the polygon or not. The points lying on the border are considered inside. Examples: Recommended ProblemPlease solve it on PRACTICE first, before moving on to the solution Solve ProblemApproach: The idea to solve this problem is based on How to
      9 min read

    • Area of a polygon with given n ordered vertices
      Given ordered coordinates of a polygon with n vertices. Find the area of the polygon. Here ordered means that the coordinates are given either in a clockwise manner or anticlockwise from the first vertex to last.Examples : Input : X[] = {0, 4, 4, 0}, Y[] = {0, 0, 4, 4}; Output : 16 Input : X[] = {0,
      6 min read

    • Tangents between two Convex Polygons
      Given two convex polygons, we aim to identify the lower and upper tangents connecting them. As shown in the figure below, TRL and TLR represent the upper and lower tangents, respectively. Examples: Input: First Polygon : [[2, 2], [3, 3], [5, 2], [4, 0], [3, 1]] Second Polygon : [[-1, 0], [0, 1], [1,
      15+ min read

    • Find number of diagonals in n sided convex polygon
      Given n > 3, find number of diagonals in n sided convex polygon.According to Wikipedia, In geometry, a diagonal is a line segment joining two vertices of a polygon or polyhedron, when those vertices are not on the same edge. Informally, any sloping line is called diagonal. Examples :  Input : 5Ou
      3 min read

    • Convex Hull using Jarvis' Algorithm or Wrapping
      Given a set of points in the plane. the convex hull of the set is the smallest convex polygon that contains all the points of it. We strongly recommend to see the following post first. How to check if two given line segments intersect?The idea of Jarvis's Algorithm is simple, we start from the leftm
      14 min read

    • Convex Hull using Graham Scan
      A convex hull is the smallest convex polygon that contains a given set of points. It is a useful concept in computational geometry and has applications in various fields such as computer graphics, image processing, and collision detection. A convex polygon is a polygon in which all interior angles a
      15+ min read

    • Dynamic Convex hull | Adding Points to an Existing Convex Hull
      Given a convex hull, we need to add a given number of points to the convex hull and print the convex hull after every point addition. The points should be in anti-clockwise order after addition of every point. Examples: Input : Convex Hull : (0, 0), (3, -1), (4, 5), (-1, 4) Point to add : (100, 100)
      15 min read

    • Deleting points from Convex Hull
      Given a fixed set of points. We need to find convex hull of given set. We also need to find convex hull when a point is removed from the set. Example: Initial Set of Points: (-2, 8) (-1, 2) (0, 1) (1, 0) (-3, 0) (-1, -9) (2, -6) (3, 0) (5, 3) (2, 5) Initial convex hull:- (-2, 8) (-3, 0) (-1, -9) (2,
      15+ min read

    • Minimum area of a Polygon with three points given
      Given three points of a regular polygon(n > 3), find the minimum area of a regular polygon (all sides same) possible with the points given.Examples: Input : 0.00 0.00 1.00 1.00 0.00 1.00 Output : 1.00 By taking point (1.00, 0.00) square is formed of side 1.0 so area = 1.00 . One thing to note in
      14 min read

  • Find Simple Closed Path for a given set of points
    Given a set of points, connect the dots without crossing. Example: Input: points[] = {(0, 3), (1, 1), (2, 2), (4, 4), (0, 0), (1, 2), (3, 1}, {3, 3}}; Output: Connecting points in following order would not cause any crossing {(0, 0), (3, 1), (1, 1), (2, 2), (3, 3), (4, 4), (1, 2), (0, 3)} We strongl
    11 min read
  • Minimum Distance between Two Points
    You are given an array arr[] of n distinct points in a 2D plane, where each point is represented by its (x, y) coordinates. Find the minimum Euclidean distance between two distinct points. Note: For two points A(px,qx) and B(py,qy) the distance Euclidean between them is: Distance = [Tex]\sqrt{(p_{x}
    15+ min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences