Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • 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
  • 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:
Flipping Sign Problem | Lazy Propagation Segment Tree
Next article icon

Flipping Sign Problem | Lazy Propagation Segment Tree

Last Updated : 09 Mar, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

Given an array of size N. There can be multiple queries of the following types.  

  1. update(l, r) : On update, flip( multiply a[i] by -1) the value of a[i] where l <= i <= r . In simple terms, change the sign of a[i] for the given range.
  2. query(l, r): On query, print the sum of the array in given range inclusive of both l and r.

Examples :

Input : arr[] = { 1, 2, 3, 4, 5 } 
update(0, 2) 
query(0, 4) 
Output: 3 
After applying update operation array becomes { -1, -2, -3, 4, 5 } . 
So the sum is 3

Input : arr[] = { 1, 2, 3, 4, 5 } 
update(0, 4) 
query(0, 4) 
Output: -15 
After applying update operation array becomes { -1, -2, -3, -4, -5 } . 
So the sum is -15 

Prerequisites: 

  1. Segment tree
  2. Lazy propagation in segment tree

Approach : 
Create a segment tree where every node store the sum of its left and right child unless it is a leaf node where the array is stored.
For update operation: 
Create a tree named lazy of size same as the above segment tree where tree store the sum of its child and lazy stores whether they have been asked to be flipped or not. If lazy is set to 1 for a range then all value under that range needs to be flipped. For update following operation are used - 
 

  • If current segment tree has lazy set to 1 then update current segment tree node by changing the sign as value needs to be flipped and also flip the value of lazy of its child and reset its own lazy to 0.
  • If current node's range lies completely in update query range then update the current node by changing its sign and also flip value of lazy of its child if not leaf node.
  • If current node's range overlaps with update range then do recursion for its children and update the current node using the sum of its children.

For query operation: 
If lazy is set to 1 then change the sign of the current node and reset current node lazy to 0 and also flip the value of lazy of its child if not leaf node. And then do simple query as done in segment tree .

Below is the implementation of the above approach : 

C++14
// C++ implementation of the approach #include <bits/stdc++.h> using namespace std;  #define MAX 15   int tree[MAX] = { 0 }; int lazy[MAX] = { 0 };   // Function to build the segment tree void build(int arr[],int node, int a, int b) {     if (a == b) {         tree[node] = arr[a];         return;     }       // left child     build(arr,2 * node, a, (a + b) / 2);       // right child     build(arr,2 * node + 1, 1 + (a + b) / 2, b);        tree[node] = tree[node * 2] +                           tree[node * 2 + 1]; }   void update_tree(int node, int a,                  int b, int i, int j) {       // If lazy of node is 1 then      // value in current node      // needs to be flipped     if (lazy[node] != 0) {          // Update it         tree[node] = tree[node] * (-1);            if (a != b) {              // flip value in lazy             lazy[node * 2] =                         !(lazy[node * 2]);                // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }            // Reset the node lazy value         lazy[node] = 0;      }       // Current segment is not     // within range [i, j]     if (a > b || a > j || b < i)         return;       // Segment is fully     // within range     if (a >= i && b <= j) {         tree[node] = tree[node] * (-1);           // Not leaf node         if (a != b) {              // Flip the value as if lazy is              // 1 and again asked to flip              // value then without flipping              // value two times             lazy[node * 2] =                           !(lazy[node * 2]);             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }           return;     }       // Updating left child     update_tree(node * 2, a,                         (a + b) / 2, i, j);      // Updating right child     update_tree(1 + node * 2, 1 +                       (a + b) / 2, b, i, j);       // Updating root with      // sum of its child     tree[node] = tree[node * 2] +                      tree[node * 2 + 1]; }   int query_tree(int node, int a,                        int b, int i, int j) {     // Out of range      if (a > b || a > j || b < i)         return 0;        // If lazy of node is 1 then value     // in current node needs to be flipped     if (lazy[node] != 0) {              tree[node] = tree[node] * (-1);          if (a != b) {             lazy[node * 2] =                          !(lazy[node * 2]);               // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);          }           lazy[node] = 0;     }       // Current segment is totally      // within range [i, j]     if (a >= i && b <= j)         return tree[node];        // Query left child     int q1 = query_tree(node * 2, a,                         (a + b) / 2, i, j);       // Query right child     int q2 = query_tree(1 + node * 2,                   1 + (a + b) / 2, b, i, j);        // Return final result     return q1 + q2; }   int main() {      int arr[]={1,2,3,4,5};      int n=sizeof(arr)/sizeof(arr[0]);      // Building segment tree     build(arr,1, 0, n - 1);      // Array is { 1, 2, 3, 4, 5 }     cout << query_tree(1, 0, n - 1, 0, 4) << endl;       // Flip range 0 to 4     update_tree(1, 0, n - 1, 0, 4);      // Array becomes { -1, -2, -3, -4, -5 }     cout << query_tree(1, 0, n - 1, 0, 4) << endl;       // Flip range 0 to 2     update_tree(1, 0, n - 1, 0, 2);      // Array becomes { 1, 2, 3, -4, -5 }     cout << query_tree(1, 0, n - 1, 0, 4) << endl;  } 
Java
// Java implementation of the approach class GFG {  static final int MAX = 15;  static int tree[] = new int[MAX]; static boolean lazy[] = new boolean[MAX];  // Function to build the segment tree static void build(int arr[],int node, int a, int b) {     if (a == b)     {         tree[node] = arr[a];         return;     }      // left child     build(arr,2 * node, a, (a + b) / 2);       // right child     build(arr,2 * node + 1, 1 + (a + b) / 2, b);       tree[node] = tree[node * 2] +                          tree[node * 2 + 1]; }  static void update_tree(int node, int a,                  int b, int i, int j) {      // If lazy of node is 1 then      // value in current node      // needs to be flipped     if (lazy[node] != false)      {          // Update it         tree[node] = tree[node] * (-1);           if (a != b)         {              // flip value in lazy             lazy[node * 2] =                         !(lazy[node * 2]);               // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }              // Reset the node lazy value         lazy[node] = false;      }      // Current segment is not     // within range [i, j]     if (a > b || a > j || b < i)         return;      // Segment is fully     // within range     if (a >= i && b <= j)      {         tree[node] = tree[node] * (-1);          // Not leaf node         if (a != b)          {              // Flip the value as if lazy is              // 1 and again asked to flip              // value then without flipping              // value two times             lazy[node * 2] =                          !(lazy[node * 2]);             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }          return;     }      // Updating left child     update_tree(node * 2, a,                         (a + b) / 2, i, j);      // Updating right child     update_tree(1 + node * 2, 1 +                      (a + b) / 2, b, i, j);       // Updating root with      // sum of its child     tree[node] = tree[node * 2] +                     tree[node * 2 + 1]; }  static int query_tree(int node, int a,                      int b, int i, int j) {     // Out of range      if (a > b || a > j || b < i)         return 0;      // If lazy of node is 1 then value     // in current node needs to be flipped     if (lazy[node] != false)      {               tree[node] = tree[node] * (-1);          if (a != b)         {             lazy[node * 2] =                          !(lazy[node * 2]);               // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);          }          lazy[node] = false;     }      // Current segment is totally      // within range [i, j]     if (a >= i && b <= j)         return tree[node];          // Query left child     int q1 = query_tree(node * 2, a,                         (a + b) / 2, i, j);       // Query right child     int q2 = query_tree(1 + node * 2,                  1 + (a + b) / 2, b, i, j);       // Return final result     return q1 + q2; }  // Driver code public static void main(String[] args) {      int arr[]={1, 2, 3, 4, 5};      int n=arr.length;      // Building segment tree     build(arr,1, 0, n - 1);      // Array is { 1, 2, 3, 4, 5 }     System.out.print(query_tree(1, 0, n - 1, 0, 4) +"\n");      // Flip range 0 to 4     update_tree(1, 0, n - 1, 0, 4);      // Array becomes { -1, -2, -3, -4, -5 }     System.out.print(query_tree(1, 0, n - 1, 0, 4) +"\n");      // Flip range 0 t0 2     update_tree(1, 0, n - 1, 0, 2);      // Array becomes { 1, 2, 3, -4, -5 }     System.out.print(query_tree(1, 0, n - 1, 0, 4) +"\n"); } }  // This code contributed by Rajput-Ji 
Python3
# Python3 implementation of the approach MAX = 15  tree = [0]*MAX lazy = [0]*MAX  # Function to build the segment tree def build(arr,node, a, b):     if (a == b):         tree[node] = arr[a]         return      # left child     build(arr,2 * node, a, (a + b) // 2)      # right child     build(arr,2 * node + 1, 1 + (a + b) // 2, b)      tree[node] = tree[node * 2] +tree[node * 2 + 1]  def update_tree(node, a,b, i, j):      # If lazy of node is 1 then     # value in current node     # needs to be flipped     if (lazy[node] != 0):          # Update it         tree[node] = tree[node] * (-1)          if (a != b):              # flip value in lazy             lazy[node * 2] =not (lazy[node * 2])              # flip value in lazy             lazy[node * 2 + 1] =not (lazy[node * 2 + 1])           # Reset the node lazy value         lazy[node] = 0       # Current segment is not     # within range [i, j]     if (a > b or a > j or b < i):         return      # Segment is fully     # within range     if (a >= i and b <= j):         tree[node] = tree[node] * (-1)          # Not leaf node         if (a != b):              # Flip the value as if lazy is             # 1 and again asked to flip             # value then without flipping             # value two times             lazy[node * 2] = not (lazy[node * 2])             lazy[node * 2 + 1] = not (lazy[node * 2 + 1])           return       # Updating left child     update_tree(node * 2, a,(a + b) // 2, i, j)      # Updating right child     update_tree(1 + node * 2, 1 +(a + b) // 2, b, i, j)      # Updating root with     # sum of its child     tree[node] = tree[node * 2] +tree[node * 2 + 1]   def query_tree(node, a,b, i, j):     # Out of range     if (a > b or a > j or b < i):         return 0      # If lazy of node is 1 then value     # in current node needs to be flipped     if (lazy[node] != 0):           tree[node] = tree[node] * (-1)         if (a != b):             lazy[node * 2] =not (lazy[node * 2])              # flip value in lazy             lazy[node * 2 + 1] = not (lazy[node * 2 + 1])           lazy[node] = 0       # Current segment is totally     # within range [i, j]     if (a >= i and b <= j):         return tree[node]      # Query left child     q1 = query_tree(node * 2, a,(a + b) // 2, i, j)      # Query right child     q2 = query_tree(1 + node * 2,1 + (a + b) // 2, b, i, j)      # Return final result     return q1 + q2  # Driver code if __name__ == '__main__':      arr=[1,2,3,4,5]      n=len(arr)      # Building segment tree     build(arr,1, 0, n - 1)      # Array is { 1, 2, 3, 4, 5     print(query_tree(1, 0, n - 1, 0, 4))      # Flip range 0 to 4     update_tree(1, 0, n - 1, 0, 4)      # Array becomes { -1, -2, -3, -4, -5     print(query_tree(1, 0, n - 1, 0, 4))      # Flip range 0 t0 2     update_tree(1, 0, n - 1, 0, 2)      # Array becomes { 1, 2, 3, -4, -5     print(query_tree(1, 0, n - 1, 0, 4))  # This code is contributed by mohit kumar 29 
C#
// C# implementation of the approach using System;  class GFG {  static readonly int MAX = 15;  static int []tree = new int[MAX]; static bool []lazy = new bool[MAX];  // Function to build the segment tree static void build(int []arr,int node, int a, int b) {     if (a == b)     {         tree[node] = arr[a];         return;     }      // left child     build(arr, 2 * node, a, (a + b) / 2);       // right child     build(arr, 2 * node + 1, 1 + (a + b) / 2, b);       tree[node] = tree[node * 2] +                          tree[node * 2 + 1]; }  static void update_tree(int node, int a,                  int b, int i, int j) {      // If lazy of node is 1 then      // value in current node      // needs to be flipped     if (lazy[node] != false)      {          // Update it         tree[node] = tree[node] * (-1);           if (a != b)         {              // flip value in lazy             lazy[node * 2] =                         !(lazy[node * 2]);               // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }              // Reset the node lazy value         lazy[node] = false;      }      // Current segment is not     // within range [i, j]     if (a > b || a > j || b < i)         return;      // Segment is fully     // within range     if (a >= i && b <= j)      {         tree[node] = tree[node] * (-1);          // Not leaf node         if (a != b)          {              // Flip the value as if lazy is              // 1 and again asked to flip              // value then without flipping              // value two times             lazy[node * 2] =                          !(lazy[node * 2]);             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);         }          return;     }      // Updating left child     update_tree(node * 2, a,                         (a + b) / 2, i, j);      // Updating right child     update_tree(1 + node * 2, 1 +                      (a + b) / 2, b, i, j);       // Updating root with      // sum of its child     tree[node] = tree[node * 2] +                     tree[node * 2 + 1]; }  static int query_tree(int node, int a,                      int b, int i, int j) {     // Out of range      if (a > b || a > j || b < i)         return 0;      // If lazy of node is 1 then value     // in current node needs to be flipped     if (lazy[node] != false)      {         tree[node] = tree[node] * (-1);          if (a != b)         {             lazy[node * 2] =                          !(lazy[node * 2]);               // flip value in lazy             lazy[node * 2 + 1] =                      !(lazy[node * 2 + 1]);          }          lazy[node] = false;     }      // Current segment is totally      // within range [i, j]     if (a >= i && b <= j)         return tree[node];          // Query left child     int q1 = query_tree(node * 2, a,                         (a + b) / 2, i, j);       // Query right child     int q2 = query_tree(1 + node * 2,                  1 + (a + b) / 2, b, i, j);       // Return readonly result     return q1 + q2; }  // Driver code public static void Main(String[] args) {      int []arr = {1, 2, 3, 4, 5};      int n = arr.Length;      // Building segment tree     build(arr, 1, 0, n - 1);      // Array is { 1, 2, 3, 4, 5 }     Console.Write(query_tree(1, 0, n - 1, 0, 4) +"\n");      // Flip range 0 to 4     update_tree(1, 0, n - 1, 0, 4);      // Array becomes { -1, -2, -3, -4, -5 }     Console.Write(query_tree(1, 0, n - 1, 0, 4) +"\n");      // Flip range 0 t0 2     update_tree(1, 0, n - 1, 0, 2);      // Array becomes { 1, 2, 3, -4, -5 }     Console.Write(query_tree(1, 0, n - 1, 0, 4) +"\n"); } }  // This code is contributed by Rajput-Ji 
JavaScript
<script>  // JavaScript implementation of the approach   let MAX = 15;  let tree = new Array(MAX).fill(0); let lazy = new Array(MAX).fill(0);  // Function to build the segment tree function build(arr,node, a, b) {     if (a == b) {         tree[node] = arr[a];         return;     }      // left child     build(arr,2 * node, a, Math.floor((a + b) / 2));      // right child     build(arr,2 * node + 1, 1 + Math.floor((a + b) / 2), b);      tree[node] = tree[node * 2] +                         tree[node * 2 + 1]; }  function update_tree(node, a, b, i, j) {      // If lazy of node is 1 then     // value in current node     // needs to be flipped     if (lazy[node] != 0) {          // Update it         tree[node] = tree[node] * (-1);          if (a != b) {              // flip value in lazy             lazy[node * 2] =                         !(lazy[node * 2]);              // flip value in lazy             lazy[node * 2 + 1] =                     !(lazy[node * 2 + 1]);         }              // Reset the node lazy value         lazy[node] = 0;     }      // Current segment is not     // within range [i, j]     if (a > b || a > j || b < i)         return;      // Segment is fully     // within range     if (a >= i && b <= j) {         tree[node] = tree[node] * (-1);          // Not leaf node         if (a != b) {              // Flip the value as if lazy is             // 1 and again asked to flip             // value then without flipping             // value two times             lazy[node * 2] =                         !(lazy[node * 2]);             lazy[node * 2 + 1] =                     !(lazy[node * 2 + 1]);         }          return;     }      // Updating left child     update_tree(node * 2, a,                         Math.floor((a + b) / 2), i, j);      // Updating right child     update_tree(1 + node * 2, 1 +                     Math.floor((a + b) / 2), b, i, j);      // Updating root with     // sum of its child     tree[node] = tree[node * 2] +                     tree[node * 2 + 1]; }  function query_tree(node, a, b, i, j) {     // Out of range     if (a > b || a > j || b < i)         return 0;      // If lazy of node is 1 then value     // in current node needs to be flipped     if (lazy[node] != 0) {               tree[node] = tree[node] * (-1);         if (a != b) {             lazy[node * 2] =                         !(lazy[node * 2]);              // flip value in lazy             lazy[node * 2 + 1] =                     !(lazy[node * 2 + 1]);         }          lazy[node] = 0;     }      // Current segment is totally     // within range [i, j]     if (a >= i && b <= j)         return tree[node];          // Query left child     let q1 = query_tree(node * 2, a,                         Math.floor((a + b) / 2), i, j);      // Query right child     let q2 = query_tree(1 + node * 2,                 1 + Math.floor((a + b) / 2), b, i, j);      // Return final result     return q1 + q2; }        let arr = [ 1,2,3,4,5];      let n = arr.length;      // Building segment tree     build(arr,1, 0, n - 1);      // Array is { 1, 2, 3, 4, 5 }     document.write(query_tree(1, 0, n - 1, 0, 4) + "<br>");      // Flip range 0 to 4     update_tree(1, 0, n - 1, 0, 4);      // Array becomes { -1, -2, -3, -4, -5 }     document.write(query_tree(1, 0, n - 1, 0, 4) + "<br>");      // Flip range 0 t0 2     update_tree(1, 0, n - 1, 0, 2);      // Array becomes { 1, 2, 3, -4, -5 }     document.write(query_tree(1, 0, n - 1, 0, 4) + "<br>");    // This code is contributed by gfgking  </script> 

Output: 
15 -15 -3

 

Time Complexity : O(log(N))
Auxiliary Space: O(log(N)), due to recursive call stacks.

Related Topic: Segment Tree


Next Article
Flipping Sign Problem | Lazy Propagation Segment Tree

G

gyanendra371
Improve
Article Tags :
  • Advanced Data Structure
  • C++ Programs
  • DSA
  • Arrays
  • Segment-Tree
Practice Tags :
  • Advanced Data Structure
  • Arrays
  • Segment-Tree

Similar Reads

    Segment Tree
    Segment Tree is a data structure that allows efficient querying and updating of intervals or segments of an array. It is particularly useful for problems involving range queries, such as finding the sum, minimum, maximum, or any other operation over a specific range of elements in an array. The tree
    3 min read
    Segment tree meaning in DSA
    A segment tree is a data structure used to effectively query and update ranges of array members. It's typically implemented as a binary tree, with each node representing a segment or range of array elements. Segment tree Characteristics of Segment Tree:A segment tree is a binary tree with a leaf nod
    2 min read
    Introduction to Segment Trees - Data Structure and Algorithm Tutorials
    A Segment Tree is used to store information about array intervals in its nodes.It allows efficient range queries over array intervals.Along with queries, it allows efficient updates of array items.For example, we can perform a range summation of an array between the range L to R in O(Log n) while al
    15+ min read
    Persistent Segment Tree | Set 1 (Introduction)
    Prerequisite : Segment Tree Persistency in Data Structure Segment Tree is itself a great data structure that comes into play in many cases. In this post we will introduce the concept of Persistency in this data structure. Persistency, simply means to retain the changes. But obviously, retaining the
    15+ min read
    Segment tree | Efficient implementation
    Let us consider the following problem to understand Segment Trees without recursion.We have an array arr[0 . . . n-1]. We should be able to, Find the sum of elements from index l to r where 0 <= l <= r <= n-1Change the value of a specified element of the array to a new value x. We need to d
    12 min read
    Iterative Segment Tree (Range Maximum Query with Node Update)
    Given an array arr[0 . . . n-1]. The task is to perform the following operation: Find the maximum of elements from index l to r where 0 <= l <= r <= n-1.Change value of a specified element of the array to a new value x. Given i and x, change A[i] to x, 0 <= i <= n-1. Examples: Input:
    14 min read
    Range Sum and Update in Array : Segment Tree using Stack
    Given an array arr[] of N integers. The task is to do the following operations: Add a value X to all the element from index A to B where 0 ? A ? B ? N-1.Find the sum of the element from index L to R where 0 ? L ? R ? N-1 before and after the update given to the array above.Example: Input: arr[] = {1
    15+ min read
    Dynamic Segment Trees : Online Queries for Range Sum with Point Updates
    Prerequisites: Segment TreeGiven a number N which represents the size of the array initialized to 0 and Q queries to process where there are two types of queries: 1 P V: Put the value V at position P.2 L R: Output the sum of values from L to R. The task is to answer these queries. Constraints: 1 ? N
    15+ min read
    Applications, Advantages and Disadvantages of Segment Tree
    First, let us understand why we need it prior to landing on the introduction so as to get why this concept was introduced. Suppose we are given an array and we need to find out the subarray Purpose of Segment Trees: A segment tree is a data structure that deals with a range of queries over an array.
    4 min read

    Lazy Propagation

    Lazy Propagation in Segment Tree
    Segment tree is introduced in previous post with an example of range sum problem. We have used the same "Sum of given Range" problem to explain Lazy propagation   How does update work in Simple Segment Tree? In the previous post, update function was called to update only a single value in array. Ple
    15+ min read
    Lazy Propagation in Segment Tree | Set 2
    Given an array arr[] of size N. There are two types of operations: Update(l, r, x) : Increment the a[i] (l <= i <= r) with value x.Query(l, r) : Find the maximum value in the array in a range l to r (both are included).Examples: Input: arr[] = {1, 2, 3, 4, 5} Update(0, 3, 4) Query(1, 4) Output
    15+ min read
    Flipping Sign Problem | Lazy Propagation Segment Tree
    Given an array of size N. There can be multiple queries of the following types. update(l, r) : On update, flip( multiply a[i] by -1) the value of a[i] where l <= i <= r . In simple terms, change the sign of a[i] for the given range.query(l, r): On query, print the sum of the array in given ran
    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