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
  • Interview Questions on Array
  • Practice Array
  • MCQs on Array
  • Tutorial on Array
  • Types of Arrays
  • Array Operations
  • Subarrays, Subsequences, Subsets
  • Reverse Array
  • Static Vs Arrays
  • Array Vs Linked List
  • Array | Range Queries
  • Advantages & Disadvantages
Open In App
Next Article:
Reorder an array such that sum of left half is not equal to sum of right half
Next article icon

Find an element in array such that sum of left array is equal to sum of right array

Last Updated : 14 Feb, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report
Try it on GfG Practice
redirect icon

Given, an array of size n. Find an element that divides the array into two sub-arrays with equal sums.

Examples: 

Input: 1 4 2 5 0
Output: 2
Explanation: If 2 is the partition, subarrays are : [1, 4] and [5]

Input: 2 3 4 1 4 5
Output: 1
Explanation: If 1 is the partition, Subarrays are : [2, 3, 4] and [4, 5]

Input: 1 2 3
Output: -1
Explanation: No sub-arrays possible. return -1

Recommended Problem
Equilibrium Point
Solve Problem

Method 1 (Simple) 
Consider every element starting from the second element. Compute the sum of elements on its left and the sum of elements on its right. If these two sums are the same, return the element.

Steps to solve the problem:

1. iterate through i=1 to n:

       *declare a leftsum variable to zero.

       *iterate through i-1 till zero and add array element to leftsum.

       *declare a rightsum variable to zero.

       *iterate through i+1 till n and add array element to rightsum.

       *check if leftsum is equal to rightsum then return arr[i].

2. return -1 in case of no point.

C++




#include <bits/stdc++.h>
#include <iostream>
using namespace std;
 
int findElement(int arr[], int n)
{
    for (int i = 1; i < n; i++) {
        int leftSum = 0;
        for (int j = i - 1; j >= 0; j--) {
            leftSum += arr[j];
        }
 
        int rightSum = 0;
        for (int k = i + 1; k < n; k++) {
            rightSum += arr[k];
        }
 
        if (leftSum == rightSum) {
            return arr[i];
        }
    }
 
    return -1;
}
 
int main()
{
    // Case 1
    int arr1[] = { 1, 4, 2, 5 };
    int n1 = sizeof(arr1) / sizeof(arr1[0]);
    cout << findElement(arr1, n1) << "\n";
 
    // Case 2
    int arr2[] = { 2, 3, 4, 1, 4, 5 };
    int n2 = sizeof(arr2) / sizeof(arr2[0]);
    cout << findElement(arr2, n2);
    return 0;
}
// This code contributed by Bhanu Teja Kodali
 
 

Java




import java.io.*;
import java.util.*;
import java.util.stream.Collectors;
 
class GFG {
 
    // Finds an element in an array such that
    // left and right side sums are equal
    static int findElement(int arr[], int n)
    {
        List<Integer> list
            = Arrays.stream(arr).boxed().collect(
                Collectors.toList());
        for (int i = 1; i <= n; i++) {
            int leftSum = list.subList(0, i)
                              .stream()
                              .mapToInt(x -> x)
                              .sum();
            int rightSum = list.subList(i + 1, n)
                               .stream()
                               .mapToInt(x -> x)
                               .sum();
 
            if (leftSum == rightSum)
                return list.get(i);
        }
        return -1;
    }
 
    public static void main(String[] args)
    {
        // Case 1
        int arr1[] = { 1, 4, 2, 5 };
        int n1 = arr1.length;
        System.out.println(findElement(arr1, n1));
 
        // Case 2
        int arr2[] = { 2, 3, 4, 1, 4, 5 };
        int n2 = arr2.length;
        System.out.println(findElement(arr2, n2));   
    }
}
// This code is contributed by Bhanu Teja Kodali
 
 

Python3




# Python 3 Program to find an element
# such that sum of right side element
# is equal to sum of left side
 
# Function to Find an element in
# an array such that left and right
# side sums are equal
 
 
def findElement(arr, n):
    for i in range(1, n):
        leftSum = sum(arr[0:i])
        rightSum = sum(arr[i+1:])
        if(leftSum == rightSum):
            return arr[i]
    return -1
 
 
# Driver Code
if __name__ == "__main__":
 
    # Case 1
    arr = [1, 4, 2, 5]
    n = len(arr)
    print(findElement(arr, n))
 
    # Case 2
    arr = [2, 3, 4, 1, 4, 5]
    n = len(arr)
    print(findElement(arr, n))
 
# This code is contributed by Bhanu Teja Kodali
 
 

C#




using System;
 
public class GFG {
 
    // Finds an element in an
    // array such that left
    // and right side sums
    // are equal
    static int findElement(int[] arr, int n)
    {
        for (int i = 1; i < n; i++) {
            int leftSum = 0;
            for (int j = i - 1; j >= 0; j--) {
                leftSum += arr[j];
            }
 
            int rightSum = 0;
            for (int k = i + 1; k < n; k++) {
                rightSum += arr[k];
            }
 
            if (leftSum == rightSum) {
                return arr[i];
            }
        }
 
        return -1;
    }
 
    static public void Main()
    {
 
        // Case 1
        int[] arr1 = { 1, 4, 2, 5 };
        int n1 = arr1.Length;
        Console.WriteLine(findElement(arr1, n1));
 
        // Case 2
        int[] arr2 = { 2, 3, 4, 1, 4, 5 };
        int n2 = arr2.Length;
        Console.WriteLine(findElement(arr2, n2));
    }
  // This code is contributed by Bhanu Teja Kodali
}
 
 

Javascript




<script>
 
// Javascript program to find an element
// such that sum of right side element
// is equal to sum of left side
 
    // Finds an element in an array such that
    // left and right side sums are equal
    function findElement(arr , n)
    {
     
        for(i = 1; i < n; i++){
          let leftSum = 0;
          for(j = i-1; j >= 0; j--){
            leftSum += arr[j];
          }
           
          let rightSum = 0;
          for(k = i+1; k < n; k++){
            rightSum += arr[k];
          }
 
          if(leftSum === rightSum){
            return arr[i];
          }
           
        }
         
        return -1;
    }
 
        // Driver code
     //Case 1
     var arr = [ 1, 4, 2, 5 ];
     var n = arr.length;
     document.write(findElement(arr, n));
      
     document.write("<br><br>")
      
     //Case 2
     var arr = [ 2, 3, 4, 1, 4, 5 ];
     var n = arr.length;
     document.write(findElement(arr, n));
 
// This code contributed by Bhanu Teja Kodali
 
</script>
 
 
Output
2 1

Time Complexity: O(n^2)

Auxiliary Space: O(1)

Method 2 (Using Prefix and Suffix Arrays) : 

We form a prefix and suffix sum arrays  Given array: 1 4 2 5 Prefix Sum:  1  5 7 12 Suffix Sum:  12 11 7 5  Now, we will traverse both prefix arrays. The index at which they yield equal result, is the index where the array is partitioned  with equal sum.

Below is the implementation of the above approach:

C++




#include <bits/stdc++.h>
using namespace std;
 
int findElement(int arr[], int n)
{
    // Forming prefix sum array from 0
    int prefixSum[n];
    prefixSum[0] = arr[0];
    for (int i = 1; i < n; i++)
        prefixSum[i] = prefixSum[i - 1] + arr[i];
 
    // Forming suffix sum array from n-1
    int suffixSum[n];
    suffixSum[n - 1] = arr[n - 1];
    for (int i = n - 2; i >= 0; i--)
        suffixSum[i] = suffixSum[i + 1] + arr[i];
 
    // Find the point where prefix and suffix
    // sums are same.
    for (int i = 1; i < n - 1; i++)
        if (prefixSum[i] == suffixSum[i])
            return arr[i];
 
    return -1;
}
 
// Driver code
int main()
{
    int arr[] = { 1, 4, 2, 5 };
    int n = sizeof(arr) / sizeof(arr[0]);
    cout << findElement(arr, n);
    return 0;
}
 
 

Java




// Java program to find an element
// such that sum of right side element
// is equal to sum of left side
public class GFG {
     
    // Finds an element in an array such that
    // left and right side sums are equal
    static int findElement(int arr[], int n)
    {
        // Forming prefix sum array from 0
        int[] prefixSum = new int[n];
        prefixSum[0] = arr[0];
        for (int i = 1; i < n; i++)
            prefixSum[i] = prefixSum[i - 1] + arr[i];
      
        // Forming suffix sum array from n-1
        int[] suffixSum = new int[n];
        suffixSum[n - 1] = arr[n - 1];
        for (int i = n - 2; i >= 0; i--)
            suffixSum[i] = suffixSum[i + 1] + arr[i];
      
        // Find the point where prefix and suffix
        // sums are same.
        for (int i = 1; i < n - 1; i++)
            if (prefixSum[i] == suffixSum[i])
                return arr[i];
      
        return -1;
    }
      
    // Driver code
    public static void main(String args[])
    {
        int arr[] = { 1, 4, 2, 5 };
        int n = arr.length;
        System.out.println(findElement(arr, n));
    }
}
// This code is contributed by Sumit Ghosh
 
 

Python 3




# Python 3 Program to find an element
# such that sum of right side element
# is equal to sum of left side
 
# Function for Finds an element in
# an array such that left and right
# side sums are equal
def findElement(arr, n) :
     
    # Forming prefix sum array from 0
    prefixSum = [0] * n
    prefixSum[0] = arr[0]
    for i in range(1, n) :
        prefixSum[i] = prefixSum[i - 1] + arr[i]
 
    # Forming suffix sum array from n-1
    suffixSum = [0] * n
    suffixSum[n - 1] = arr[n - 1]
    for i in range(n - 2, -1, -1) :
        suffixSum[i] = suffixSum[i + 1] + arr[i]
 
    # Find the point where prefix
    # and suffix sums are same.
    for i in range(1, n - 1, 1) :
        if prefixSum[i] == suffixSum[i] :
            return arr[i]
         
    return -1
 
# Driver Code
if __name__ == "__main__" :
     
    arr = [ 1, 4, 2, 5]
    n = len(arr)
    print(findElement(arr, n))
 
# This code is contributed by ANKITRAI1
 
 

C#




// C# program to find an element
// such that sum of right side element
// is equal to sum of left side
using System;
 
class GFG
{
     
    // Finds an element in an
    // array such that left
    // and right side sums
    // are equal
    static int findElement(int []arr,
                           int n)
    {
        // Forming prefix sum
        // array from 0
        int[] prefixSum = new int[n];
        prefixSum[0] = arr[0];
        for (int i = 1; i < n; i++)
            prefixSum[i] = prefixSum[i - 1] +
                                     arr[i];
     
        // Forming suffix sum
        // array from n-1
        int[] suffixSum = new int[n];
        suffixSum[n - 1] = arr[n - 1];
        for (int i = n - 2; i >= 0; i--)
            suffixSum[i] = suffixSum[i + 1] +
                                     arr[i];
     
        // Find the point where prefix
        // and suffix sums are same.
        for (int i = 1; i < n - 1; i++)
            if (prefixSum[i] == suffixSum[i])
                return arr[i];
     
        return -1;
    }
     
    // Driver code
    public static void Main()
    {
        int []arr = { 1, 4, 2, 5 };
        int n = arr.Length;
        Console.WriteLine(findElement(arr, n));
    }
}
 
// This code is contributed by anuj_67.
 
 

PHP




<?php
function findElement(&$arr, $n)
{
    // Forming prefix sum array from 0
    $prefixSum = array_fill(0, $n, NULL);
    $prefixSum[0] = $arr[0];
    for ($i = 1; $i < $n; $i++)
        $prefixSum[$i] = $prefixSum[$i - 1] +
                                    $arr[$i];
 
    // Forming suffix sum array from n-1
    $suffixSum = array_fill(0, $n, NULL);
    $suffixSum[$n - 1] = $arr[$n - 1];
    for ($i = $n - 2; $i >= 0; $i--)
        $suffixSum[$i] = $suffixSum[$i + 1] +
                                    $arr[$i];
 
    // Find the point where prefix
    // and suffix sums are same.
    for ($i = 1; $i < $n - 1; $i++)
        if ($prefixSum[$i] == $suffixSum[$i])
            return $arr[$i];
 
    return -1;
}
 
// Driver code
$arr = array( 1, 4, 2, 5 );
$n = sizeof($arr);
echo findElement($arr, $n);
 
// This code is contributed
// by ChitraNayal
?>
 
 

Javascript




<script>
 
// Javascript program to find an element
// such that sum of right side element
// is equal to sum of left side
 
    // Finds an element in an array such that
    // left and right side sums are equal
    function findElement(arr , n)
    {
        // Forming prefix sum array from 0
        var prefixSum = Array(n).fill(0);
        prefixSum[0] = arr[0];
        for (i = 1; i < n; i++)
            prefixSum[i] = prefixSum[i - 1] + arr[i];
 
        // Forming suffix sum array from n-1
        var suffixSum = Array(n).fill(0);
        suffixSum[n - 1] = arr[n - 1];
        for (i = n - 2; i >= 0; i--)
            suffixSum[i] = suffixSum[i + 1] + arr[i];
 
        // Find the point where prefix and suffix
        // sums are same.
        for (i = 1; i < n - 1; i++)
            if (prefixSum[i] == suffixSum[i])
                return arr[i];
 
        return -1;
    }
 
    // Driver code
     
        var arr = [ 1, 4, 2, 5 ];
        var n = arr.length;
        document.write(findElement(arr, n));
 
// This code contributed by umadevi9616
 
</script>
 
 
Output
2

Time Complexity: O(n)

Auxiliary Space: O(n)

Method 3 (Space efficient) 
We calculate the sum of the whole array except the first element in right_sum, considering it to be the partitioning element. Now, we traverse the array from left to right, subtracting an element from right_sum and adding an element to left_sum. At the point where right_sum equals left_sum, we get the partition.

Below is the implementation :  

C++




#include <bits/stdc++.h>
using namespace std;
 
// Function to compute partition
int findElement(int arr[], int size)
{
    int right_sum = 0, left_sum = 0;
 
    // Computing right_sum
    for (int i = 1; i < size; i++)
        right_sum += arr[i];
 
    // Checking the point of partition
    // i.e. left_Sum == right_sum
    for (int i = 0, j = 1; j < size; i++, j++) {
        right_sum -= arr[j];
        left_sum += arr[i];
 
        if (left_sum == right_sum)
            return arr[i + 1];
    }
 
    return -1;
}
 
// Driver
int main()
{
    int arr[] = { 2, 3, 4, 1, 4, 5 };
    int size = sizeof(arr) / sizeof(arr[0]);
    cout << findElement(arr, size);
    return 0;
}
 
 

Java




// Java program to find an element
// such that sum of right side element
// is equal to sum of left side
public class GFG {
     
    // Function to compute partition
    static int findElement(int arr[], int size)
    {
        int right_sum = 0, left_sum = 0;
      
        // Computing right_sum
        for (int i = 1; i < size; i++)
            right_sum += arr[i];
      
        // Checking the point of partition
        // i.e. left_Sum == right_sum
        for (int i = 0, j = 1; j < size; i++, j++) {
            right_sum -= arr[j];
            left_sum += arr[i];
      
            if (left_sum == right_sum)
                return arr[i + 1];
        }
      
        return -1;
    }
      
    // Driver
    public static void main(String args[])
    {
        int arr[] = { 2, 3, 4, 1, 4, 5 };
        int size = arr.length;
        System.out.println(findElement(arr, size));
    }
}
// This code is contributed by Sumit Ghosh
 
 

Python 3




# Python 3 Program to find an element
# such that sum of right side element
# is equal to sum of left side
 
# Function to compute partition
def findElement(arr, size) :
 
    right_sum, left_sum = 0, 0
 
    # Computing right_sum
    for i in range(1, size) :
        right_sum += arr[i]
 
    i, j = 0, 1
 
    # Checking the point of partition
    # i.e. left_Sum == right_sum
    while j < size :
        right_sum -= arr[j]
        left_sum += arr[i]
 
        if left_sum == right_sum :
            return arr[i + 1]
 
        j += 1
        i += 1
 
    return -1
 
# Driver Code
if __name__ == "__main__" :
     
    arr = [ 2, 3, 4, 1, 4, 5]
    n = len(arr)
    print(findElement(arr, n))
 
# This code is contributed by ANKITRAI1
 
 

C#




// C# program to find an
// element such that sum
// of right side element
// is equal to sum of
// left side
using System;
 
class GFG
{
    // Function to compute
    // partition
    static int findElement(int []arr,
                           int size)
    {
        int right_sum = 0,
            left_sum = 0;
     
        // Computing right_sum
        for (int i = 1; i < size; i++)
            right_sum += arr[i];
     
        // Checking the point
        // of partition i.e.
        // left_Sum == right_sum
        for (int i = 0, j = 1;
                 j < size; i++, j++)
        {
            right_sum -= arr[j];
            left_sum += arr[i];
     
            if (left_sum == right_sum)
                return arr[i + 1];
        }
     
        return -1;
    }
     
    // Driver Code
    public static void Main()
    {
        int []arr = {2, 3, 4, 1, 4, 5};
        int size = arr.Length;
        Console.WriteLine(findElement(arr, size));
    }
}
 
// This code is contributed
// by anuj_67.
 
 

PHP




<?php
// Function to compute partition
function findElement(&$arr, $size)
{
    $right_sum = 0;
    $left_sum = 0;
 
    // Computing right_sum
    for ($i = 1; $i < $size; $i++)
        $right_sum += $arr[$i];
 
    // Checking the point of partition
    // i.e. left_Sum == right_sum
    for ($i = 0, $j = 1;
         $j < $size; $i++, $j++)
    {
        $right_sum -= $arr[$j];
        $left_sum += $arr[$i];
 
        if ($left_sum == $right_sum)
            return $arr[$i + 1];
    }
 
    return -1;
}
 
// Driver Code
$arr = array( 2, 3, 4, 1, 4, 5 );
$size = sizeof($arr);
echo findElement($arr, $size);
 
// This code is contributed
// by ChitraNayal
?>
 
 

Javascript




<script>
     // Function to compute partition
    function findElement(arr) {
        let right_sum = 0, left_sum = 0;
  
        // Computing right_sum
        for (let i = 1; i < arr.length; i++)
            right_sum += arr[i];
  
        // Checking the point of partition
        // i.e. left_Sum == right_sum
        for (let i = 0, j = 1; j < arr.length; i++, j++) {
            right_sum -= arr[j];
            left_sum += arr[i];
  
            if (left_sum === right_sum)
                return arr[i + 1];
        }
  
        return -1;
    }
  
    // Driver
    let arr = [ 2, 3, 4, 1, 4, 5 ];
    document.write(findElement(arr));
    
 
// This code is contributed by Surbhi Tyagi
</script>
 
 
Output
1

Time complexity: O(n)
Auxiliary Space: O(1)

Method 4 (Both Time and Space Efficient)

We define two pointers i and j to traverse the array from left and right, left_sum and right_sum to store sum from right and left respectively  If left_sum is lesser then increment i and if right_sum is lesser then decrement j  and, find a position where left_sum == right_sum and i and j are next to each other

Note: This solution is only applicable if the array contains only positive elements.

Below is the implementation of the above approach: 

C++




// C++ program to find an element
// such that sum of right side element
// is equal to sum of left side
#include<bits/stdc++.h>
using namespace std;
     
// Function to compute
// partition
int findElement(int arr[],
                int size)
{
  int right_sum = 0,
      left_sum = 0;
   
  // Maintains left
  // cumulative sum
  left_sum = 0;
 
  // Maintains right
  // cumulative sum
  right_sum = 0;
  int i = -1, j = -1;
 
  for(i = 0, j = size - 1;
      i < j; i++, j--)
  {
    left_sum += arr[i];
    right_sum += arr[j];
 
    // Keep moving i towards
    // center until left_sum
    //is found lesser than right_sum
    while(left_sum < right_sum &&
          i < j)
    {
      i++;
      left_sum += arr[i];
    }
     
    // Keep moving j towards
    // center until right_sum is
    // found lesser than left_sum
    while(right_sum < left_sum &&
          i < j)
    {
      j--;
      right_sum += arr[j];
    }
  }
   
  if(left_sum == right_sum && i == j)
    return arr[i];
  else
    return -1;
}
 
// Driver code
int main()
{
  int arr[] = {2, 3, 4,
               1, 4, 5};
  int size = sizeof(arr) /
             sizeof(arr[0]);
  cout << (findElement(arr, size));
}
 
// This code is contributed by shikhasingrajput
 
 

Java




// Java program to find an element
// such that sum of right side element
// is equal to sum of left side
public class Gfg {
     
    // Function to compute partition
    static int findElement(int arr[], int size)
    {
        int right_sum = 0, left_sum = 0;
        // Maintains left cumulative sum
        left_sum = 0;
         
        // Maintains right cumulative sum
        right_sum=0;
        int i = -1, j = -1;
         
        for( i = 0, j = size-1 ; i < j ; i++, j-- ){
            left_sum += arr[i];
            right_sum += arr[j];
             
            // Keep moving i towards center until
            // left_sum is found lesser than right_sum
            while(left_sum < right_sum && i < j){
                i++;
                left_sum += arr[i];
            }
            // Keep moving j towards center until
            // right_sum is found lesser than left_sum
            while(right_sum < left_sum && i < j){
                j--;
                right_sum += arr[j];
            }
        }
        if(left_sum == right_sum && i == j)
            return arr[i];
        else
            return -1;
    }
     
    // Driver code
    public static void main(String args[])
    {
        int arr[] = {2, 3, 4, 1, 4, 5};
        int size = arr.length;
        System.out.println(findElement(arr, size));
    }
}
 
 

Python3




# Python3 program to find an element
# such that sum of right side element
# is equal to sum of left side
 
# Function to compute partition
def findElement(arr, size):
   
    # Maintains left cumulative sum
    left_sum = 0;
 
    # Maintains right cumulative sum
    right_sum = 0;
    i = 0; j = -1;
    j = size - 1;
     
    while(i < j):
        if(i < j):
            left_sum += arr[i];
            right_sum += arr[j];
 
            # Keep moving i towards center
            # until left_sum is found
            # lesser than right_sum
            while (left_sum < right_sum and
                   i < j):
                i += 1;
                left_sum += arr[i];
 
            # Keep moving j towards center
            # until right_sum is found
            # lesser than left_sum
            while (right_sum < left_sum and
                   i < j):
                j -= 1;
                right_sum += arr[j];
            j -= 1
            i += 1
    if (left_sum == right_sum && i == j):
        return arr[i];
    else:
        return -1;
 
# Driver code
if __name__ == '__main__':
   
    arr = [2, 3, 4,
           1, 4, 5];
    size = len(arr);
    print(findElement(arr, size));
 
# This code is contributed by shikhasingrajput
 
 

C#




// C# program to find an element
// such that sum of right side element
// is equal to sum of left side
using System;
 
class GFG{
     
// Function to compute partition
static int findElement(int []arr, int size)
{
    int right_sum = 0, left_sum = 0;
     
    // Maintains left cumulative sum
    left_sum = 0;
     
    // Maintains right cumulative sum
    right_sum = 0;
    int i = -1, j = -1;
     
    for(i = 0, j = size - 1; i < j; i++, j--)
    {
        left_sum += arr[i];
        right_sum += arr[j];
         
        // Keep moving i towards center until
        // left_sum is found lesser than right_sum
        while (left_sum < right_sum && i < j)
        {
            i++;
            left_sum += arr[i];
        }
         
        // Keep moving j towards center until
        // right_sum is found lesser than left_sum
        while (right_sum < left_sum && i < j)
        {
            j--;
            right_sum += arr[j];
        }
    }
    if (left_sum == right_sum && i == j)
        return arr[i];
    else
        return -1;
}
 
// Driver code
public static void Main(String []args)
{
    int []arr = { 2, 3, 4, 1, 4, 5 };
    int size = arr.Length;
     
    Console.WriteLine(findElement(arr, size));
}
}
 
// This code is contributed by Amit Katiyar
 
 

Javascript




<script>
// javascript program to find an element
// such that sum of right side element
// is equal to sum of left side
 
    // Function to compute partition
    function findElement(arr , size) {
        var right_sum = 0, left_sum = 0;
        // Maintains left cumulative sum
        left_sum = 0;
 
        // Maintains right cumulative sum
        right_sum = 0;
        var i = -1, j = -1;
 
        for (i = 0, j = size - 1; i < j; i++, j--) {
            left_sum += arr[i];
            right_sum += arr[j];
 
            // Keep moving i towards center until
            // left_sum is found lesser than right_sum
            while (left_sum < right_sum && i < j) {
                i++;
                left_sum += arr[i];
            }
            // Keep moving j towards center until
            // right_sum is found lesser than left_sum
            while (right_sum < left_sum && i < j) {
                j--;
                right_sum += arr[j];
            }
        }
        if (left_sum == right_sum && i == j)
            return arr[i];
        else
            return -1;
    }
 
    // Driver code
     
        var arr = [ 2, 3, 4, 1, 4, 5 ];
        var size = arr.length;
        document.write(findElement(arr, size));
 
// This code contributed by gauravrajput1
</script>
 
 
Output
1

Since all loops start traversing from the last updated i and j pointers and do not cross each other, they run n times in the end.

Time Complexity – O(n) 
Auxiliary Space – O(1)

Method 5 (The efficient algorithm):

  1. Here we define two pointers to the array -> start = 0, end = n-1
  2. Two variables to take care of sum -> left_sum = 0, right_sum = 0

Here our algorithm goes like this:

  1. We initialize for loop till the entire size of the array
  2. Basically we check if left_sum > right_sum => add the current end element to the right_sum and decrement end
  3. If right_sum < left_sum => add the current start element to the left_sum and increment start
  4. By these two conditions, we make sure that left_sum and right_sum are nearly balanced, so we can arrive at our solution easily
  5. To make this work during all test cases we need to add a couple of conditional statements to our logic:
  6. If the equilibrium element is found our start will be equal to the end variable and left_sum will be equal right_sum => return the equilibrium element (here we say start == end because we increment/ decrement the pointer after adding the current start/ end value to respective sum. So if, equilibrium element is found start and end should be at the same location)
  7. If start is equal to end variable but left_sum is not equal right_sum => no equilibrium element return -1
  8. If left_sum is equal right_sum, but start is not equal to end => we are still in the middle of the algorithm even though we found that left_sum is equal right_sum we haven’t got that one required equilibrium element (So, in this case, add the current end element to the right_sum and decrement end (or) add the current start element to the left_sum and increment start, to make our algorithm continue further).
  9. Even here there is one test case that needs to be handled:
  10. When there is only one element in the array our algorithm exits without entering for a loop.
  11. So we can check if our functions enter the loop if not we can directly return the value as the answer.

Below is the implementation of the above approach:

C++




#include <bits/stdc++.h>
using namespace std;
 
// Function to find equilibrium point
// a: input array
// n: size of array
int equilibriumPoint(int a[], int n)
{
    // Here we define two pointers to the array -> start =
    // 0, end = n-1 Two variables to take care of sum ->
    // left_sum = 0, right_sum = 0
    int i = 0, start = 0, end = n - 1, left_sum = 0,
        right_sum = 0;
 
    for (i = 0; i < n; i++) {
 
        // if the equilibrium element is found our start
        // will be equal to end variable and  left_sum will
        // be equal right_sum => return the equilibrium
        // element
        if (start == end && right_sum == left_sum)
            return a[start];
 
        // if start is equal to end variable but left_sum is
        // not equal right_sum => no equilibrium element
        // return -1
        if (start == end)
            return -1;
 
        // if left_sum  > right_sum => add the current end
        // element to the right_sum and decrement end
        if (left_sum > right_sum) {
            right_sum += a[end];
            end--;
        }
 
        // if right_sum < left_sum => add the current start
        // element to the left_sum and increment start
        else if (right_sum > left_sum) {
            left_sum += a[start];
            start++;
        }
        /*
            if  left_sum is equal right_sum but start is not
           equal to end => we are still in the middle of
           algorithm even though we found that left_sum is
           equal right_sum we haven't got that one required
           equilibrium element (So, in this case add the
           current end element to the right_sum and
           decrement end (or) add the current start element
           to the left_sum and increment start, to make our
           algorithm continue further)
        */
 
        else {
            right_sum += a[end];
            end--;
        }
    }
 
    // When there is only one element in array our algorithm
    // exits without entering for loop So we can check if our
    // functions enters the loop if not we can directly
    // return the value as answer
    if (!i) {
        return a[0];
    }
}
 
// Driver code
int main()
{
    int arr[] = { 2, 3, 4, 1, 4, 5 };
    int size = sizeof(arr) / sizeof(arr[0]);
    cout << (equilibriumPoint(arr, size));
}
 
 

Java




/*package whatever //do not write package name here */
import java.io.*;
class GFG
{
 
  // Function to find equilibrium point
  // a: input array
  // n: size of array
  static int equilibriumPoint(int a[], int n)
  {
 
    // Here we define two pointers to the array -> start =
    // 0, end = n-1 Two variables to take care of sum ->
    // left_sum = 0, right_sum = 0
    int i = 0, start = 0, end = n - 1, left_sum = 0,
    right_sum = 0;
 
    for (i = 0; i < n; i++)
    {
 
      // if the equilibrium element is found our start
      // will be equal to end variable and  left_sum will
      // be equal right_sum => return the equilibrium
      // element
      if (start == end && right_sum == left_sum)
        return a[start];
 
      // if start is equal to end variable but left_sum is
      // not equal right_sum => no equilibrium element
      // return -1
      if (start == end)
        return -1;
 
      // if left_sum  > right_sum => add the current end
      // element to the right_sum and decrement end
      if (left_sum > right_sum)
      {
        right_sum += a[end];
        end--;
      }
 
      // if right_sum < left_sum => add the current start
      // element to the left_sum and increment start
      else if (right_sum > left_sum)
      {
        left_sum += a[start];
        start++;
      }
      /*
                if  left_sum is equal right_sum but start is not
               equal to end => we are still in the middle of
               algorithm even though we found that left_sum is
               equal right_sum we haven't got that one required
               equilibrium element (So, in this case add the
               current end element to the right_sum and
               decrement end (or) add the current start element
               to the left_sum and increment start, to make our
               algorithm continue further)
            */
 
      else {
        right_sum += a[end];
        end--;
      }
    }
 
    // When there is only one element in array our algorithm
    // exits without entering for loop So we can check if our
    // functions enters the loop if not we can directly
    // return the value as answer
    if (i == 0)
    {
      return a[0];
    }
    return -1;
  }
 
  // Driver code
  public static void main (String[] args)
  {
    int arr[] = { 2, 3, 4, 1, 4, 5 };
    int size = arr.length;
    System.out.println(equilibriumPoint(arr, size));
  }
}
 
// This code is contributed by avanitrachhadiya2155
 
 

Python3




# Function to find equilibrium point
# a: input array
# n: size of array
def equilibriumPoint(a, n):
 
    # Here we define two pointers to the array -> start =
    # 0, end = n-1 Two variables to take care of sum ->
    # left_sum = 0, right_sum = 0
    i,start,end,left_sum,right_sum = 0,0,n - 1,0,0
 
    for i in range(n):
 
        # if the equilibrium element is found our start
        # will be equal to end variable and left_sum will
        # be equal right_sum => return the equilibrium
        # element
        if (start == end and right_sum == left_sum):
            return a[start]
 
        # if start is equal to end variable but left_sum is
        # not equal right_sum => no equilibrium element
        # return -1
        if (start == end):
            return -1
 
        # if left_sum > right_sum => add the current end
        # element to the right_sum and decrement end
        if (left_sum > right_sum):
            right_sum += a[end]
            end -= 1
 
        # if right_sum < left_sum => add the current start
        # element to the left_sum and increment start
        elif (right_sum > left_sum):
            left_sum += a[start]
            start += 1
         
        #     if left_sum is equal right_sum but start is not
        # equal to end => we are still in the middle of
        # algorithm even though we found that left_sum is
        # equal right_sum we haven't got that one required
        # equilibrium element (So, in this case add the
        # current end element to the right_sum and
        # decrement end (or) add the current start element
        # to the left_sum and increment start, to make our
        # algorithm continue further)
        else:
            right_sum += a[end]
            end -= 1
 
    # When there is only one element in array our algorithm
    # exits without entering for loop So we can check if our
    # functions enters the loop if not we can directly
    # return the value as answer
    if (not i):
        return a[0]
 
# Driver code
arr = [ 2, 3, 4, 1, 4, 5 ]
size = len(arr)
print(equilibriumPoint(arr, size))
 
# This code is contributed by Shinjanpatra
 
 

C#




using System;
 
public class GFG{
     
    // Function to find equilibrium point
  // a: input array
  // n: size of array
  static int equilibriumPoint(int[] a, int n)
  {
  
    // Here we define two pointers to the array -> start =
    // 0, end = n-1 Two variables to take care of sum ->
    // left_sum = 0, right_sum = 0
    int i = 0, start = 0, end = n - 1, left_sum = 0,
    right_sum = 0;
  
    for (i = 0; i < n; i++)
    {
  
      // if the equilibrium element is found our start
      // will be equal to end variable and  left_sum will
      // be equal right_sum => return the equilibrium
      // element
      if (start == end && right_sum == left_sum)
        return a[start];
  
      // if start is equal to end variable but left_sum is
      // not equal right_sum => no equilibrium element
      // return -1
      if (start == end)
        return -1;
  
      // if left_sum  > right_sum => add the current end
      // element to the right_sum and decrement end
      if (left_sum > right_sum)
      {
        right_sum += a[end];
        end--;
      }
  
      // if right_sum < left_sum => add the current start
      // element to the left_sum and increment start
      else if (right_sum > left_sum)
      {
        left_sum += a[start];
        start++;
      }
      /*
                if  left_sum is equal right_sum but start is not
               equal to end => we are still in the middle of
               algorithm even though we found that left_sum is
               equal right_sum we haven't got that one required
               equilibrium element (So, in this case add the
               current end element to the right_sum and
               decrement end (or) add the current start element
               to the left_sum and increment start, to make our
               algorithm continue further)
            */
  
      else {
        right_sum += a[end];
        end--;
      }
    }
  
    // When there is only one element in array our algorithm
    // exits without entering for loop So we can check if our
    // functions enters the loop if not we can directly
    // return the value as answer
    if (i == 0)
    {
      return a[0];
    }
    return -1;
  }
  
  // Driver code
     
    static public void Main (){
         
        int[] arr = { 2, 3, 4, 1, 4, 5 };
    int size = arr.Length;
    Console.WriteLine(equilibriumPoint(arr, size));
         
    }
}
 
 

Javascript




<script>
 
// Function to find equilibrium point
// a: input array
// n: size of array
function equilibriumPoint(a, n)
{
    // Here we define two pointers to the array -> start =
    // 0, end = n-1 Two variables to take care of sum ->
    // left_sum = 0, right_sum = 0
    let i = 0, start = 0, end = n - 1, left_sum = 0,
        right_sum = 0;
 
    for (i = 0; i < n; i++) {
 
        // if the equilibrium element is found our start
        // will be equal to end variable and left_sum will
        // be equal right_sum => return the equilibrium
        // element
        if (start == end && right_sum == left_sum)
            return a[start];
 
        // if start is equal to end variable but left_sum is
        // not equal right_sum => no equilibrium element
        // return -1
        if (start == end)
            return -1;
 
        // if left_sum > right_sum => add the current end
        // element to the right_sum and decrement end
        if (left_sum > right_sum) {
            right_sum += a[end];
            end--;
        }
 
        // if right_sum < left_sum => add the current start
        // element to the left_sum and increment start
        else if (right_sum > left_sum) {
            left_sum += a[start];
            start++;
        }
        /*
            if left_sum is equal right_sum but start is not
        equal to end => we are still in the middle of
        algorithm even though we found that left_sum is
        equal right_sum we haven't got that one required
        equilibrium element (So, in this case add the
        current end element to the right_sum and
        decrement end (or) add the current start element
        to the left_sum and increment start, to make our
        algorithm continue further)
        */
 
        else {
            right_sum += a[end];
            end--;
        }
    }
 
    // When there is only one element in array our algorithm
    // exits without entering for loop So we can check if our
    // functions enters the loop if not we can directly
    // return the value as answer
    if (!i) {
        return a[0];
    }
}
 
// Driver code
    let arr = [ 2, 3, 4, 1, 4, 5 ];
    let size = arr.length;
    document.write(equilibriumPoint(arr, size));
 
 
 
 
// This code is contributed by Surbhi Tyagi.
</script>
 
 
Output
1

Time complexity: O(n)
Auxiliary Space: O(1)

Method 6: We can use divide and conquer to improve the number of traces to find an equilibrium point, as we know, most of the time a point comes from a mid, which can be considered as an idea to solve this problem

  • We can consider that the equilibrium point is mid of the list
  • If yes (left sum is equal to right sum) — best case – return the index +1 (as that would be actual count by human)
  • If not check where the weight is inclined either the left side or right side

    a) perform the increase and decrease to get the new sum and return the index when equal, Also return -1 if inclination changes to what we had in beginning:

Below is the implementation of the above approach:

C++




#include <bits/stdc++.h>
using namespace std;
 
int sum(int a[], int start, int end)
{
    int result = 0;
 
    for (int i = start; i < end; i++) {
        result += a[i];
    }
 
    return result;
}
 
int equilibriumPoint(int A[], int n)
{
    int index = n / 2;
    int left_sum = sum(A, 0, index);
    int right_sum = sum(A, index + 1, n);
 
    if (left_sum == right_sum) {
        return A[index];
    }
 
    else if (left_sum > right_sum) {
        while (index >= 0) {
            left_sum -= A[index - 1];
            right_sum += A[index];
            index -= 1;
 
            if (right_sum > left_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
 
    else if (right_sum > left_sum) {
        while (index <= n - 1) {
            left_sum += A[index];
            right_sum -= A[index + 1];
            index += 1;
            if (left_sum > right_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
    return -1;
}
 
// Driver code
int main()
{
    int arr[] = { 2, 3, 4, 1, 4, 5 };
    int size = sizeof(arr) / sizeof(arr[0]);
    cout << (equilibriumPoint(arr, size));
}
 
 

Java




import java.io.*;
 
class GFG {
    
   static int sum(int a[],int start,int end)
    {
        int result=0;
         
        for(int i=start;i<end;i++)
        {
            result+=a[i];
        }
         
        return result;
         
    }
    public static int equilibriumPoint(int A[], int n) {
 
      int index = n/2;
      int left_sum = sum(A,0,index);
      int right_sum = sum(A,index+1,n);
       
      if(left_sum == right_sum)
      {
          return A[index];
      }
       
      else if(left_sum > right_sum)
      {
          while(index >= 0)
          {
                left_sum -= A[index-1];
                right_sum += A[index];
                index -= 1;
                 
                if(right_sum > left_sum)
                    return -1;
                else if(left_sum == right_sum)
                    return A[index];
          }
      }
       
       
      else if(right_sum > left_sum)
      {
            while(index <= n-1)
            {
                left_sum += A[index];
                right_sum -= A[index+1];
                index += 1;
                if (left_sum > right_sum)
                    return -1;
                else if (left_sum == right_sum)
                    return A[index];
            }
      }
            return -1;
    }
    // Driver code
  public static void main (String[] args)
  {
    int arr[] = { 2, 3, 4, 1, 4, 5 };
    int size = arr.length;
    System.out.println(equilibriumPoint(arr, size));
  }
}
 
 

Python3




def sum(A):
    result = 0
    for item in A:
        result += item
    return result
 
def equilibriumPoint(A, N):
    index = N // 2
    left_sum = sum(A[:index])
    right_sum = sum(A[index+1:])
     
    if left_sum == right_sum:
        return A[index]
     
    elif left_sum > right_sum:
        while(index >= 0):
            left_sum -= A[index-1]
            right_sum += A[index]
            index -= 1
            if right_sum > left_sum:
                return -1
            elif left_sum == right_sum:
                return A[index]
     
    elif right_sum > left_sum:
        while(index <= N-1):
            left_sum += A[index]
            right_sum -= A[index+1]
            index += 1
            if left_sum > right_sum:
                return -1
            elif left_sum == right_sum:
                return A[index]
     
    else:
        return -1
     
 
# Driver code
arr = [ 2, 3, 4, 1, 4, 5 ]
size = len(arr)
print(equilibriumPoint(arr, size))
                 
            
 
 

C#




using System;
 
public class GFG{
     
  static int sum(int[] A,int start,int end)
    {
        int result=0;
         
        for(int i=start;i<end;i++)
        {
            result+=A[i];
        }
         
        return result;
         
    }
   
   
  static int equilibriumPoint(int[] A, int n)
  {
    int index = n / 2;
    int left_sum = sum(A, 0, index);
    int right_sum = sum(A, index + 1, n);
 
    if (left_sum == right_sum) {
        return A[index];
    }
 
    else if (left_sum > right_sum) {
        while (index >= 0) {
            left_sum -= A[index - 1];
            right_sum += A[index];
            index -= 1;
 
            if (right_sum > left_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
 
    else if (right_sum > left_sum) {
        while (index <= n - 1) {
            left_sum += A[index];
            right_sum -= A[index + 1];
            index += 1;
            if (left_sum > right_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
    return -1;
     
  }
  
  // Driver code
     
    static public void Main (){
         
    int[] arr = new int []{ 2, 3, 4, 1, 4, 5 };
    int size = arr.Length;
    Console.WriteLine(equilibriumPoint(arr, size));
         
    }
}
 
 

Javascript




// JS code for above approach
function sum(a, start, end)
{
    let result = 0;
 
    for (let i = start; i < end; i++) {
        result += a[i];
    }
 
    return result;
}
 
function equilibriumPoint(A, n)
{
    let index = n / 2;
    let left_sum = sum(A, 0, index);
    let right_sum = sum(A, index + 1, n);
 
    if (left_sum == right_sum) {
        return A[index];
    }
 
    else if (left_sum > right_sum) {
        while (index >= 0) {
            left_sum -= A[index - 1];
            right_sum += A[index];
            index -= 1;
 
            if (right_sum > left_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
 
    else if (right_sum > left_sum) {
        while (index <= n - 1) {
            left_sum += A[index];
            right_sum -= A[index + 1];
            index += 1;
            if (left_sum > right_sum)
                return -1;
            else if (left_sum == right_sum)
                return A[index];
        }
    }
    return -1;
}
 
// Driver code
    let arr = [ 2, 3, 4, 1, 4, 5 ];
    let size = arr.length;
    console.log(equilibriumPoint(arr, size));
 
// This code is contributed by adityamaharshi21
 
 
Output
1

Time complexity: O(n)
Auxiliary Space: O(1)



Next Article
Reorder an array such that sum of left half is not equal to sum of right half
https://media.geeksforgeeks.org/auth/avatar.png
GeeksforGeeks
Improve
Article Tags :
  • Arrays
  • DSA
  • Accolite
  • Adobe
  • Amazon
  • prefix-sum
  • Zoho
Practice Tags :
  • Accolite
  • Adobe
  • Amazon
  • Zoho
  • Arrays
  • prefix-sum

Similar Reads

  • Reorder an array such that sum of left half is not equal to sum of right half
    Given an array arr[] of even length, the task is to check whether is it possible to reorder the array element such that the sum of the left half is not equal to the sum of the right half of the array. If it is possible then print "Yes" with the reordered sequence else print "No". Examples: Input: ar
    5 min read
  • Find the array element having equal sum of Prime Numbers on its left and right
    Given an array arr[] of size N, the task is to find the index in the given array where the sum of the prime numbers present to its left is equal to the sum of the prime numbers present to its right. Examples: Input: arr[] = {11, 4, 7, 6, 13, 1, 5}Output: 3Explanation: Sum of prime numbers to left of
    13 min read
  • Find array elements equal to sum of any subarray of at least size 2
    Given an array arr[], the task is to find the elements from the array which are equal to the sum of any sub-array of size greater than 1.Examples: Input: arr[] = {1, 2, 3, 4, 5, 6} Output: 3, 5, 6 Explanation: The elements 3, 5, 6 are equal to sum of subarrays {1, 2},{2, 3} and {1, 2, 3} respectivel
    6 min read
  • Sum of elements in 1st array such that number of elements less than or equal to them in 2nd array is maximum
    Given two unsorted arrays arr1[] and arr2[], the task is to find the sum of elements of arr1[] such that the number of elements less than or equal to them in arr2[] is maximum. Examples: Input: arr1[] = {1, 2, 3, 4, 7, 9}, arr2[] = {0, 1, 2, 1, 1, 4} Output: 20 Below table shows the count of element
    15 min read
  • Find original array from encrypted array (An array of sums of other elements)
    Find original array from a given encrypted array of size n. Encrypted array is obtained by replacing each element of the original array by the sum of the remaining array elements. Examples : Input : arr[] = {10, 14, 12, 13, 11} Output : {5, 1, 3, 2, 4} Original array {5, 1, 3, 2, 4} Encrypted array
    6 min read
  • Construct array with sum of product of same indexed elements in the given array equal to zero
    Given an array, arr[] of size N (always even), the task is to construct a new array consisting of N non-zero integers such that the sum of the product of the same indexed elements of arr[] and the new array is equal to 0. If multiple solutions exist, print any one of them. Examples: Input: arr[] = {
    6 min read
  • Check if each element of an Array is the Sum of any two elements of another Array
    Given two arrays A[] and B[] consisting of N integers, the task is to check if each element of array B[] can be formed by adding any two elements of array A[]. If it is possible, then print “Yes”. Otherwise, print “No”. Examples: Input: A[] = {3, 5, 1, 4, 2}, B[] = {3, 4, 5, 6, 7} Output: Yes Explan
    6 min read
  • Find pair i, j such that |A[i]−A[j]| is same as sum of difference of them with any Array element
    Given an array A[] having N non-negative integers, find a pair of indices i and j such that the absolute difference between them is same as the sum of differences of those with any other array element i.e., | A[i] − A[k] | + | A[k]− A[j] | = | A[i] − A[j] |, where k can be any index. Examples: Input
    7 min read
  • Choose two elements from the given array such that their sum is not present in any of the arrays
    Given two arrays A[] and B[], the task is to choose two elements X and Y such that X belongs to A[] and Y belongs to B[] and (X + Y) must not be present in any of the array.Examples: Input: A[] = {3, 2, 2}, B[] = {1, 5, 7, 7, 9} Output: 3 9 3 + 9 = 12 and 12 is not present in any of the given arrays
    5 min read
  • Find the sums for which an array can be divided into sub-arrays of equal sum
    Given an array of integers arr[], the task is to find all the values for sum such that for a value sum[i] the array can be divided into sub-arrays of sum equal to sum[i]. If array cannot be divided into sub-arrays of equal sum then print -1. Examples: Input: arr[] = {2, 2, 2, 1, 1, 2, 2} Output: 2 4
    10 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