- Blogathon, Blogathon-2021, disjoint-set, Graph, Mathematical, union-find

Maximum element in connected component of given node for Q queries

  #include using namespace std;  int Find(vector& parent, int a){    return parent[a] = (parent[a] == a)                           ? a                           : (Find(parent, parent[a]));}  void Union(vector& parent,           vector& rank,           vector& maxValue,           int…

Read More

- Blogathon, Blogathon-2021, Geometric, Linked List, Mathematical, Matrix, square-rectangle

Form a Rectangle from boundary elements of Matrix using Linked List

class Node:          def __init__(self, val): = val = None        self.prev = None = None        self.bottom = None    class LinkedList:          def __init__(self):        self.head = None              def Quad(self, grid,…

Read More