Easy to understand || Union Find
\nclass Solution {\npublic:\n    int findParent(int node, vector<int>&parent)\n    {\n        int curr = node;\n        while(parent[curr] != curr) curr = paren
```\nclass Solution {\npublic:\n    int findParent(int node, vector<int>&parent)\n    {\n        int curr = node;\n        while(parent[curr] != curr) curr = parent[curr];\n        return curr;\n    }\n    void merge(int node1, int node2, vector<int>&parent)\n    {\n        int parent1 = findParent(node1, parent);\n        int parent2 = findParent(node2, parent);\n        if (parent1 == parent2) return;\n        \n        int minParent = min(parent1, parent2);\n        int maxParent = max(parent1, parent2);\n        parent[maxParent] = minParent;\n    }\n    string smallestEquivalentString(string s1, string s2, string baseStr)\n    {\n        int n = s1.size();\n        vector<int>parent(26);\n        for (int i = 0; i < 26; i++) parent[i] = i;\n        for (int i = 0; i < n; i++) merge(s1[i] - \'a\', s2[i] - \'a\', parent);\n        //================================================\n        string ans = "";\n        for (int i = 0; i < baseStr.size(); i++) \n        {\n            int minParentIdx = findParent(baseStr[i] - \'a\', parent);\n            char minParent = minParentIdx + \'a\';\n            ans.push_back(minParent);\n        }\n        return ans;\n\n    }\n};\n```
['Depth-First Search', 'Union Find', 'C', 'C++']