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 Problems on String
  • Practice String
  • MCQs on String
  • Tutorial on String
  • String Operations
  • Sort String
  • Substring & Subsequence
  • Iterate String
  • Reverse String
  • Rotate String
  • String Concatenation
  • Compare Strings
  • KMP Algorithm
  • Boyer-Moore Algorithm
  • Rabin-Karp Algorithm
  • Z Algorithm
  • String Guide for CP
Open In App
Next Article:
Check if it is possible to transform one string to another
Next article icon

An in-place algorithm for String Transformation

Last Updated : 20 Jun, 2022
Comments
Improve
Suggest changes
Like Article
Like
Report

Given a string, move all even positioned elements to the end of the string. While moving elements, keep the relative order of all even positioned and odd positioned elements the same. For example, if the given string is “a1b2c3d4e5f6g7h8i9j1k2l3m4”, convert it to “abcdefghijklm1234567891234” in-place and in O(n) time complexity.

Below are the steps:

  1. Cut out the largest prefix sub-string of the size of the form 3^k + 1. In this step, we find the largest non-negative integer k such that 3^k+1 is smaller than or equal to n (length of the string)
  2. Apply cycle leader iteration algorithm ( it has been discussed below ), starting with index 1, 3, 9…… to this sub-string. Cycle leader iteration algorithm moves all the items of this sub-string to their correct positions, i.e. all the alphabets are shifted to the left half of the sub-string and all the digits are shifted to the right half of this sub-string.
  3. Process the remaining sub-string recursively using steps#1 and #2.
  4. Now, we only need to join the processed sub-strings together. Start from any end ( say from left ), pick two sub-strings, and apply the below steps:
    ….4.1 Reverse the second half of the first sub-string. 
    ….4.2 Reverse the first half of the second sub-string. 
    ….4.3 Reverse the second half of the first sub-string and the first half of second sub-string together.
  5. Repeat step#4 until all sub-strings are joined. It is similar to k-way merging where the first sub-string is joined with the second. The resultant is merged with third and so on.

Let us understand it with an example:

Please note that we have used values like 10, 11 12 in the below example. Consider these values as single characters only. These values are used for better readability.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 a 1 b 2 c 3 d 4 e 5 f  6  g  7  h  8  i  9  j  10 k  11 l  12 m  13

After breaking into the size of the form 3^k + 1, two sub-strings are formed of size 10 each. The third sub-string is formed of size 4 and the fourth sub-string is formed of size 2.

0 1 2 3 4 5 6 7 8 9          a 1 b 2 c 3 d 4 e 5           10 11 12 13 14 15 16 17 18 19           f  6  g  7  h  8  i  9  j  10             20 21 22 23  k  11 l  12   24 25 m  13

After applying the cycle leader iteration algorithm to first sub-string:

0 1 2 3 4 5 6 7 8 9           a b c d e 1 2 3 4 5            10 11 12 13 14 15 16 17 18 19           f  6  g  7  h  8  i  9  j  10   20 21 22 23  k  11 l  12   24 25 m  13

After applying cycle leader iteration algorithm to second sub-string:

0 1 2 3 4 5 6 7 8 9           a b c d e 1 2 3 4 5            10 11 12 13 14 15 16 17 18 19            f  g  h  i  j  6  7  8  9  10   20 21 22 23  k  11 l  12   24 25 m 13

After applying cycle leader iteration algorithm to third sub-string:

0 1 2 3 4 5 6 7 8 9           a b c d e 1 2 3 4 5            10 11 12 13 14 15 16 17 18 19             f  g  h  i  j  6  7  8  9  10  20 21 22 23  k  l  11 12   24 25 m  13

After applying cycle leader iteration algorithm to fourth sub-string:

0 1 2 3 4 5 6 7 8 9   a b c d e 1 2 3 4 5    10 11 12 13 14 15 16 17 18 19              f  g  h  i  j  6  7  8  9  10     20 21 22 23  k  l  11 12   24 25 m  13

Joining first sub-string and second sub-string: 
1. Second half of first sub-string and the first half of second sub-string reversed.

0 1 2 3 4 5 6 7 8 9           a b c d e 5 4 3 2 1            <--------- First Sub-string    10 11 12 13 14 15 16 17 18 19              j  i  h  g  f  6  7  8  9  10  <--------- Second Sub-string    20 21 22 23  k  l  11 12   24 25 m  13

2. Second half of first sub-string and the first half of second sub-string reversed together( They are merged, i.e. there are only three sub-strings now ).

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a b c d e f g h i j 1  2  3  4  5  6  7  8  9  10  20 21 22 23  k  l  11 12   24 25 m  13

Joining first sub-string and second sub-string: 
1. Second half of first sub-string and the first half of the second sub-string reversed.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 a b c d e f g h i j 10 9  8  7  6  5  4  3  2  1 <--------- First Sub-string    20 21 22 23  l  k  11 12                                      <--------- Second Sub-string  24 25 m  13

2. Second half of first sub-string and the first half of second sub-string reversed together( They are merged, i.e. there are only two sub-strings now ).

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23   a b c d e f g h i j k  l  1  2  3  4  5  6  7  8  9  10 11 12    24 25 m  13 

Joining first sub-string and second sub-string: 
1. Second half of first sub-string and the first half of second sub-string reversed.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23  a b c d e f g h i j k  l  12 11 10 9  8  7  6  5  4  3  2  1 <----- First Sub-string  24 25 m  13   <----- Second Sub-string 

2. Second half of first sub-string and the first half of second sub-string reversed together( They are merged, i.e. there is only one sub-string now ).

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 a b c d e f g h i j k  l  m  1  2  3  4  5  6  7  8  9  10 11 12 13

Since all sub-strings have been joined together, we are done.

How does the cycle leader iteration algorithm work?
Let us understand it with an example: 

Input: 0 1 2 3 4 5 6 7 8 9 a 1 b 2 c 3 d 4 e 5  Output: 0 1 2 3 4 5 6 7 8 9  a b c d e 1 2 3 4 5  Old index    New index 0        0 1        5 2        1 3        6 4        2 5        7 6        3 7        8 8        4 9        9

Let len be the length of the string. If we observe carefully, we find that the new index is given by the below formula: 

if( oldIndex is odd )     newIndex = len / 2 + oldIndex / 2; else         newIndex = oldIndex / 2;

So, the problem reduces to shifting the elements to new indexes based on the above formula.
Cycle leader iteration algorithm will be applied starting from the indices of the form 3^k, starting with k = 0.

Below are the steps:

  1. Find new position for item at position i. Before putting this item at new position, keep the back-up of element at new position. Now, put the item at new position.
  2. Repeat step#1 for new position until a cycle is completed, i.e. until the procedure comes back to the starting position.
  3. Apply cycle leader iteration algorithm to the next index of the form 3^k. Repeat this step until 3^k < len. 
Consider input array of size 28: The first cycle leader iteration, starting with index 1: 1->14->7->17->22->11->19->23->25->26->13->20->10->5->16->8->4->2->1 The second cycle leader iteration, starting with index 3: 3->15->21->24->12->6->3 The third cycle leader iteration, starting with index 9: 9->18->9

Based on the above algorithm, below is the code:  

C++




// C++ implementation of above approach
#include <bits/stdc++.h>
using namespace std;
 
// A utility function to swap characters
void swap ( char* a, char* b )
{
    char t = *a;
    *a = *b;
    *b = t;
}
 
// A utility function to reverse string str[low..high]
void reverse ( char* str, int low, int high )
{
    while ( low < high )
    {
        swap( &str[low], &str[high] );
        ++low;
        --high;
    }
}
 
// Cycle leader algorithm to move all even
//  positioned elements at the end.
void cycleLeader ( char* str, int shift, int len )
{
    int j;
    char item;
 
    for (int i = 1; i < len; i *= 3 )
    {
        j = i;
 
        item = str[j + shift];
        do
        {
            // odd index
            if ( j & 1 )
                j = len / 2 + j / 2;
            // even index
            else
                j /= 2;
 
            // keep the back-up of element at new position
            swap (&str[j + shift], &item);
        }
        while ( j != i );
    }
}
 
// The main function to transform a string. This function 
// mainly uses cycleLeader() to transform
void moveNumberToSecondHalf( char* str )
{
    int k, lenFirst;
 
    int lenRemaining = strlen( str );
    int shift = 0;
 
    while ( lenRemaining )
    {
        k = 0;
 
        // Step 1: Find the largest prefix
        // subarray of the form 3^k + 1
        while ( pow( 3, k ) + 1 <= lenRemaining )
            k++;
        lenFirst = pow( 3, k - 1 ) + 1;
        lenRemaining -= lenFirst;
 
        // Step 2: Apply cycle leader algorithm
        // for the largest subarrau
        cycleLeader ( str, shift, lenFirst );
 
        // Step 4.1: Reverse the second half of first subarray
        reverse ( str, shift / 2, shift - 1 );
 
        // Step 4.2: Reverse the first half of second sub-string.
        reverse ( str, shift, shift + lenFirst / 2 - 1 );
 
        // Step 4.3 Reverse the second half of first sub-string
        // and first half of second sub-string together
        reverse ( str, shift / 2, shift + lenFirst / 2 - 1 );
 
        // Increase the length of first subarray
        shift += lenFirst;
    }
}
 
// Driver program to test above function
int main()
{
    char str[] = "a1b2c3d4e5f6g7";
    moveNumberToSecondHalf( str );
    cout<<str;
    return 0;
}
 
// This is code is contributed by rathbhupendra
 
 

Java




// Java implementation of above approach
import java.util.*;
 
class GFG{
     
static char []str;
 
// A utility function to reverse
// String str[low..high]
static void reverse(int low, int high)
{
    while (low < high)
    {
        char t = str[low];
        str[low] = str[high];
        str[high] = t;
        ++low;
        --high;
    }
}
 
// Cycle leader algorithm to move all even
// positioned elements at the end.
static void cycleLeader(int shift, int len)
{
    int j;
    char item;
 
    for(int i = 1; i < len; i *= 3)
    {
        j = i;
        item = str[j + shift];
         
        do
        {
             
            // odd index
            if (j % 2 == 1)
                j = len / 2 + j / 2;
                 
            // even index
            else
                j /= 2;
 
            // Keep the back-up of element at
            // new position
            char t = str[j + shift];
            str[j + shift] = item;
            item = t;
        }
        while (j != i);
    }
}
 
// The main function to transform a String.
// This function mainly uses cycleLeader()
// to transform
static void moveNumberToSecondHalf()
{
    int k, lenFirst;
    int lenRemaining = str.length;
    int shift = 0;
 
    while (lenRemaining > 0)
    {
        k = 0;
 
        // Step 1: Find the largest prefix
        // subarray of the form 3^k + 1
        while (Math.pow(3, k) + 1 <= lenRemaining)
            k++;
             
        lenFirst = (int)Math.pow(3, k - 1) + 1;
        lenRemaining -= lenFirst;
 
        // Step 2: Apply cycle leader algorithm
        // for the largest subarrau
        cycleLeader(shift, lenFirst);
 
        // Step 4.1: Reverse the second half
        // of first subarray
        reverse(shift / 2, shift - 1);
 
        // Step 4.2: Reverse the first half
        // of second sub-String.
        reverse(shift, shift + lenFirst / 2 - 1);
 
        // Step 4.3 Reverse the second half
        // of first sub-String and first half
        // of second sub-String together
        reverse(shift / 2, shift + lenFirst / 2 - 1);
 
        // Increase the length of first subarray
        shift += lenFirst;
    }
}
 
// Driver code
public static void main(String[] args)
{
    String st = "a1b2c3d4e5f6g7";
    str = st.toCharArray();
     
    moveNumberToSecondHalf();
     
    System.out.print(str);
}
}
 
// This code is contributed by Princi Singh
 
 

Python3




# Python implementation of above approach
 
# A utility function to reverse string str[low..high]
def Reverse(string: list, low: int, high: int):
    while low < high:
        string[low], string[high] = string[high], string[low]
        low += 1
        high -= 1
 
# Cycle leader algorithm to move all even
# positioned elements at the end.
def cycleLeader(string: list, shift: int, len: int):
    i = 1
    while i < len:
        j = i
        item = string[j + shift]
 
        while True:
 
            # odd index
            if j & 1:
                j = len // 2 + j // 2
 
            # even index
            else:
                j //= 2
 
            # keep the back-up of element at new position
            string[j + shift], item = item, string[j + shift]
 
            if j == i:
                break
        i *= 3
 
# The main function to transform a string. This function
# mainly uses cycleLeader() to transform
def moveNumberToSecondHalf(string: list):
    k, lenFirst = 0, 0
    lenRemaining = len(string)
    shift = 0
 
    while lenRemaining:
        k = 0
 
        # Step 1: Find the largest prefix
        # subarray of the form 3^k + 1
        while pow(3, k) + 1 <= lenRemaining:
            k += 1
        lenFirst = pow(3, k - 1) + 1
        lenRemaining -= lenFirst
 
        # Step 2: Apply cycle leader algorithm
        # for the largest subarrau
        cycleLeader(string, shift, lenFirst)
 
        # Step 4.1: Reverse the second half of first subarray
        Reverse(string, shift // 2, shift - 1)
 
        # Step 4.2: Reverse the first half of second sub-string
        Reverse(string, shift, shift + lenFirst // 2 - 1)
 
        # Step 4.3 Reverse the second half of first sub-string
        # and first half of second sub-string together
        Reverse(string, shift // 2, shift + lenFirst // 2 - 1)
 
        # Increase the length of first subarray
        shift += lenFirst
 
# Driver Code
if __name__ == "__main__":
 
    string = "a1b2c3d4e5f6g7"
    string = list(string)
    moveNumberToSecondHalf(string)
    print(''.join(string))
 
# This code is contributed by
# sanjeev2552
 
 

C#




// C# implementation of
// the above approach
using System;
class GFG{
     
static char []str;
 
// A utility function to
// reverse String str[low
// ..high]
static void reverse(int low,
                    int high)
{
  while (low < high)
  {
    char t = str[low];
    str[low] = str[high];
    str[high] = t;
    ++low;
    --high;
  }
}
 
// Cycle leader algorithm to
// move all even positioned
// elements at the end.
static void cycleLeader(int shift,
                        int len)
{
  int j;
  char item;
 
  for(int i = 1;
          i < len; i *= 3)
  {
    j = i;
    item = str[j + shift];
 
    do
    {
      // odd index
      if (j % 2 == 1)
        j = len / 2 + j / 2;
 
      // even index
      else
        j /= 2;
 
      // Keep the back-up of
      // element at new position
      char t = str[j + shift];
      str[j + shift] = item;
      item = t;
    }
    while (j != i);
  }
}
 
// The main function to transform
// a String. This function mainly
// uses cycleLeader() to transform
static void moveNumberToSecondHalf()
{
  int k, lenFirst;
  int lenRemaining = str.Length;
  int shift = 0;
 
  while (lenRemaining > 0)
  {
    k = 0;
 
    // Step 1: Find the largest prefix
    // subarray of the form 3^k + 1
    while (Math.Pow(3, k) +
           1 <= lenRemaining)
      k++;
 
    lenFirst = (int)Math.Pow(3,
                             k - 1) + 1;
    lenRemaining -= lenFirst;
 
    // Step 2: Apply cycle leader
    // algorithm for the largest
    // subarrau
    cycleLeader(shift, lenFirst);
 
    // Step 4.1: Reverse the second
    // half of first subarray
    reverse(shift / 2,
            shift - 1);
 
    // Step 4.2: Reverse the
    // first half of second
    // sub-String.
    reverse(shift, shift +
            lenFirst / 2 - 1);
 
    // Step 4.3 Reverse the second
    // half of first sub-String and
    // first half of second sub-String
    // together
    reverse(shift / 2, shift +
            lenFirst / 2 - 1);
 
    // Increase the length of
    // first subarray
    shift += lenFirst;
  }
}
 
// Driver code
public static void Main(String[] args)
{
  String st = "a1b2c3d4e5f6g7";
  str = st.ToCharArray();
  moveNumberToSecondHalf();
  Console.Write(str);
}
}
 
// This code is contributed by 29AjayKumar
 
 

Javascript




<script>
// Javascript implementation of above approach
 
let str;
 
// A utility function to reverse
// String str[low..high]
function reverse(low,high)
{
    while (low < high)
    {
        let t = str[low];
        str[low] = str[high];
        str[high] = t;
        ++low;
        --high;
    }
}
 
// Cycle leader algorithm to move all even
// positioned elements at the end.
function cycleLeader(shift,len)
{
    let j;
    let item;
  
    for(let i = 1; i < len; i *= 3)
    {
        j = i;
        item = str[j + shift];
          
        do
        {
              
            // odd index
            if (j % 2 == 1)
                j = Math.floor(len / 2) + Math.floor(j / 2);
                  
            // even index
            else
                j =Math.floor(j/2);
  
            // Keep the back-up of element at
            // new position
            let t = str[j + shift];
            str[j + shift] = item;
            item = t;
        }
        while (j != i);
    }
}
 
// The main function to transform a String.
// This function mainly uses cycleLeader()
// to transform
function moveNumberToSecondHalf()
{
    let k, lenFirst;
    let lenRemaining = str.length;
    let shift = 0;
  
    while (lenRemaining > 0)
    {
        k = 0;
  
        // Step 1: Find the largest prefix
        // subarray of the form 3^k + 1
        while (Math.pow(3, k) + 1 <= lenRemaining)
            k++;
              
        lenFirst = Math.floor(Math.pow(3, k - 1)) + 1;
        lenRemaining -= lenFirst;
  
        // Step 2: Apply cycle leader algorithm
        // for the largest subarrau
        cycleLeader(shift, lenFirst);
  
        // Step 4.1: Reverse the second half
        // of first subarray
        reverse(Math.floor(shift / 2), shift - 1);
  
        // Step 4.2: Reverse the first half
        // of second sub-String.
        reverse(shift, shift + Math.floor(lenFirst / 2) - 1);
  
        // Step 4.3 Reverse the second half
        // of first sub-String and first half
        // of second sub-String together
        reverse(Math.floor(shift / 2), shift + Math.floor(lenFirst / 2) - 1);
  
        // Increase the length of first subarray
        shift += lenFirst;
    }
}
 
// Driver code
let st = "a1b2c3d4e5f6g7";
    str = st.split("");
      
    moveNumberToSecondHalf();
      
    document.write(str.join(""));
 
// This code is contributed by rag2127
</script>
 
 
Output
abcdefg1234567

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

Click here to see various test cases.
Notes: 

  1. If the array size is already in the form 3^k + 1, We can directly apply cycle leader iteration algorithm. There is no need of joining.
  2. Cycle leader iteration algorithm is only applicable to arrays of size of the form 3^k + 1.

How is the time complexity O(n) ? 
Each item in a cycle is shifted at most once. Thus time complexity of the cycle leader algorithm is O(n). The time complexity of the reverse operation is O(n). We will soon update the mathematical proof of the time complexity of the algorithm.

Exercise: 
Given string in the form “abcdefg1234567”, convert it to “a1b2c3d4e5f6g7” in-place and in O(n) time complexity.



Next Article
Check if it is possible to transform one string to another
author
kartik
Improve
Article Tags :
  • DSA
  • Strings
Practice Tags :
  • Strings

Similar Reads

  • Move To Front Data Transform Algorithm
    What is the MTF transform? The MTF (Move to Front) is a data transformation algorithm that restructures data in such a way that the transformed message is more compressible and therefore used as an extra step in compression. Technically, it is an invertible transform of a sequence of input character
    9 min read
  • Minimize the String Transformation Cost
    Given a string Str and cost array C[] of size n replacing Str[i] with any character will have cost C[i]. The task is to minimize the cost where every odd i, for all i from 1 to n have to match either, S[i] = S[n-i+1] and S[i+1] = S[n-i] or,S[i] = S[n-i] and S[i+1] = S[n-i+1]Examples: Input: N = 4, S
    6 min read
  • Maximum weight transformation of a given string
    Given a string consisting of only A's and B's. We can transform the given string to another string by toggling any character. Thus many transformations of the given string are possible. The task is to find Weight of the maximum weight transformation. Weight of a string is calculated using below form
    9 min read
  • Check if it is possible to transform one string to another
    Given two strings s1 and s2(all letters in uppercase). Check if it is possible to convert s1 to s2 by performing following operations. Make some lowercase letters uppercase. Delete all the lowercase letters. Examples: Input : s1 = daBcd s2 = ABC Output : yes Explanation : daBcd -> dABCd -> ABC
    7 min read
  • Transform an Empty String to a Given String
    Given a string s1 and an empty string s2, you have to transform the empty string s2 to given string s1 using the given moves. In one move, you can create a sequence of identical characters on string s2 or overwrite any substring with a new character on string s2. The task is to minimize the number o
    7 min read
  • Boyer Moore Algorithm for Pattern Searching
    Pattern searching is an important problem in computer science. When we do search for a string in a notepad/word file, browser, or database, pattern searching algorithms are used to show the search results. A typical problem statement would be-  " Given a text txt[0..n-1] and a pattern pat[0..m-1] wh
    15+ min read
  • Aho-Corasick Algorithm for Pattern Searching
    Given an input text and an array of k words, arr[], find all occurrences of all words in the input text. Let n be the length of text and m be the total number of characters in all words, i.e. m = length(arr[0]) + length(arr[1]) + ... + length(arr[k-1]). Here k is total numbers of input words. Exampl
    15+ min read
  • Remove all occurrences of string t in string s using KMP Algorithm
    Given two strings s and t, the task is to remove all occurrences of t in s and return the modified string s, and you have to use the KMP algorithm to solve this. Examples: Input: s = "abcdefgabcabcabdefghabc", t = "abc"Output: "defgdefgh" Input: s = "aaabbbccc", t = "bbb"Output: "aaaccc" Approach: T
    8 min read
  • Move spaces to front of string in single traversal
    Given a string that has set of words and spaces, write a program to move all spaces to front of string, by traversing the string only once. Examples: Input : str = "geeks for geeks" Output : str = " geeksforgeeks" Input : str = "move these spaces to beginning" Output : str = " movethesespacestobegin
    6 min read
  • Transform One String to Another using Minimum Number of Given Operation
    Given two strings A and B, the task is to convert A to B if possible. The only operation allowed is to put any character from A and insert it at front. Find if it's possible to convert the string. If yes, then output minimum no. of operations required for transformation. Examples: Input: A = "ABD",
    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