# Recursion

### Kth largest element in an N-array Tree

#include using namespace std;  class Node {public:    int data;    vector childs;};  int largestELe = INT_MIN;  void largestEleUnderRange(    Node* root, int data){            if (root->data < data) {        largestELe =…

### Minimum time required to color all edges of a Tree

#include using namespace std;  int ans = 0;  vector edges[100000];  void Add_edge(int u, int v){    edges[u].push_back(v);    edges[v].push_back(u);}  void minTimeToColor(int node, int parent,                    int arrival_time){            int current_time = 0;      for…

### Print all Hamiltonian Cycles in an Undirected Graph

import java.util.ArrayList;class GFG {                  boolean isSafe(int v, int graph[][],                   ArrayList path,                   int pos)    {                                if (graph[path.get(pos – 1)][v]            == 0)            return false;                          for (int i = 0; i…

### Split an array into subarrays with maximum Bitwise XOR of their respective Bitwise OR values

Split an array into subarrays with maximum Bitwise XOR of their respective Bitwise OR valuesGiven an array arr[] consisting of…

### Count N-digit numbers whose digits does not exceed absolute difference of the two previous digits

#include using namespace std;  long long dp[50][10][10];  long long countOfNumbers(int digit, int prev1,                         int prev2, int N){        if (digit == N + 1)        return 1;          if…

### Count substrings having frequency of a character exceeding that of another character in a string

#include using namespace std;void update(int ind, vector& segTree,            int n){        ind += n;        segTree[ind]++;    for (; ind > 1; ind >>= 1) {                segTree[ind >>…

### Subtract 1 from a number represented as Linked List

#include using namespace std;  class Node {public:    int data;    Node* next;};  Node* newNode(int data){        Node* new_node = new Node;    new_node->data = data;    new_node->next = NULL;          return new_node;}  int subtractOneUtil(Node*…

### Count ways to represent a number as sum of perfect squares

Count ways to represent a number as sum of perfect squaresGiven an integer N, the task is to find the…