{"id":2821,"date":"2024-03-24T07:51:16","date_gmt":"2024-03-24T07:51:16","guid":{"rendered":"https:\/\/favtutor.com\/articles\/?p=2821"},"modified":"2025-04-08T09:11:38","modified_gmt":"2025-04-08T09:11:38","slug":"implement-trie-problem","status":"publish","type":"post","link":"https:\/\/favtutor.com\/articles\/implement-trie-problem\/","title":{"rendered":"Implement Trie Problem (C++, JAVA, Python)"},"content":{"rendered":"\n<p>Trie is an advanced data structure used to store strings so that we can search the string in O(N) time complexity, where N is the maximum length of a string. The concept behind a trie is to store strings in a tree structure where each node has 26 child nodes, each representing a character of the alphabet. In this article, we will discuss the problem &#8220;Implement Trie&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to <strong>Implement<\/strong> Trie?<\/strong><\/h2>\n\n\n\n<p>Trie is a special type of tree in which each node has 26 child nodes. Trie is used to store strings in a tree so that we can find them in O(N) time complexity.&nbsp;<\/p>\n\n\n\n<p>To implement a Trie, we will create a class called Node. Each node in this class will contain 26 characters and a Boolean variable, &#8216;flag&#8217;, indicating whether any string ends at this node. If the boolean value is true, it means a string ends at this node. If it is false, it means this node represents a substring of another string. Now, we will iterate over each string and store it in the trie.\u00a0<\/p>\n\n\n\n<p>Let\u2019s examine this process step by step.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>First, create a class having a list of 26 characters and a boolean variable flag whose initial value is false.&nbsp;<\/li>\n\n\n\n<li>Now iterate over the array if it is inserted, then call the insert function; otherwise, call the search function.<\/li>\n\n\n\n<li>To create an insert function, you need an input string and the root of the tree. Now, iterate through the whole string and call the list for that character. For example, if you want to store &#8220;bat&#8221;, then first call the &#8220;b&#8221; in the root node and update the current node with the &#8220;b&#8221; node. Now store the &#8220;a&#8221; in the current node and update the current node with the &#8220;a&#8221; node. Finally, call the &#8220;t&#8221; node in the current node and mark its flag as true.<\/li>\n\n\n\n<li>To create a search function, you need the input string and the root node of the tree. Now, iterate through the entire string as we have done in the insert function. The only change in this function is to check for the last character to determine if the flag value is true or not. If it&#8217;s true, it means the string lies inside the array; otherwise, it does not. Additionally, if any character is not within the string, return false.<\/li>\n<\/ul>\n\n\n\n<p>Let\u2019s examine the code for Implement Trie Problem.<\/p>\n\n\n\n<p><strong>C++ Code<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-c++src&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;C++&quot;,&quot;modeName&quot;:&quot;cpp&quot;}\">#include&lt;bits\/stdc++.h&gt;\n\nusing namespace std;\n\n\u00a0\u00a0\u00a0\u00a0class Node{\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0public:\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node* list[26];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bool flag=false;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0bool key(char ch){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(list[ch-'a']==NULL) return false;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return true;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0void put(char ch){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0list[ch-'a']=new Node();\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0};\n\n\u00a0\u00a0\u00a0\u00a0Node* root = new Node();\u00a0\n\n\u00a0\u00a0\u00a0\u00a0void insert(string word) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node* curr=root;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for(int i=0;i&lt;word.size();i++){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(!(curr-&gt;key(word[i]))){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr-&gt;put(word[i]);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr=curr-&gt;list[word[i]-'a'];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr-&gt;flag=true;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return;\n\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0bool search(string word) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node* curr=root;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for(int i=0; i&lt;word.size();i++){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if(!(curr-&gt;key(word[i]))){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return false;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr=curr-&gt;list[word[i]-'a'];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return\u00a0 curr-&gt;flag;\n\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0int main(){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0vector&lt;string&gt; v = {&quot;ant&quot;, &quot;an&quot;, &quot;app&quot;, &quot;ban&quot;, &quot;bat&quot;, &quot;bell&quot;};\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0vector&lt;string&gt; s = { &quot;ap&quot;, &quot;apple&quot;, &quot;ban&quot;, &quot;bell&quot;};\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for(int i=0; I &lt;v.size(); i++){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0insert(v[i]);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for(int i=0; i&lt; s.size(); i++){\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0(search(s[i]))? cout&lt;&lt;&quot;True&quot;&lt;&lt;endl:cout&lt;&lt;&quot;False&quot;&lt;&lt;endl;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return 0;\n\n\u00a0\u00a0\u00a0\u00a0}<\/pre><\/div>\n\n\n\n<p><strong>Java Code<\/strong>:<\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text\/x-java&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;Java&quot;,&quot;modeName&quot;:&quot;java&quot;}\">import java.util.*;\n\nclass Trie {\n\n\u00a0\u00a0\u00a0\u00a0static class Node {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node[] list = new Node[26];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0boolean flag = false;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0boolean key(char ch) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return list[ch - 'a'] != null;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0void put(char ch) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0list[ch - 'a'] = new Node();\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0static Node root = new Node();\n\n\u00a0\u00a0\u00a0\u00a0static void insert(String word) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node curr = root;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; word.length(); i++) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (!curr.key(word.charAt(i))) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr.put(word.charAt(i));\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = curr.list[word.charAt(i) - 'a'];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr.flag = true;\n\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0static boolean search(String word) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Node curr = root;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (int i = 0; i &lt; word.length(); i++) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if (!curr.key(word.charAt(i))) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return false;\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = curr.list[word.charAt(i) - 'a'];\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return curr.flag;\n\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0public static void main(String[] args) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0List&lt;String&gt; v = Arrays.asList(&quot;ant&quot;, &quot;an&quot;, &quot;app&quot;, &quot;ban&quot;, &quot;bat&quot;, &quot;bell&quot;);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0List&lt;String&gt; s = Arrays.asList(&quot;ap&quot;, &quot;apple&quot;, &quot;ban&quot;, &quot;bell&quot;);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (String word : v) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0insert(word);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for (String word : s) {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0System.out.println(search(word) ? &quot;True&quot; : &quot;False&quot;);\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0}\n\n}<\/pre><\/div>\n\n\n\n<p><strong>Python Code:<\/strong><\/p>\n\n\n\n<div class=\"wp-block-codemirror-blocks-code-block code-block\"><pre class=\"CodeMirror\" data-setting=\"{&quot;mode&quot;:&quot;python&quot;,&quot;mime&quot;:&quot;text\/x-python&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:false,&quot;lineWrapping&quot;:false,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;Python&quot;,&quot;modeName&quot;:&quot;python&quot;}\">class Trie:\n\n\u00a0\u00a0\u00a0\u00a0class Node:\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0def __init__(self):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0self.list = [None] * 26\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0self.flag = False\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0def key(self, ch):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return self.list[ord(ch) - ord('a')] is not None\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0def put(self, ch):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0self.list[ord(ch) - ord('a')] = Trie.Node()\n\n\u00a0\u00a0\u00a0\u00a0root = Node()\n\n\u00a0\u00a0\u00a0\u00a0@staticmethod\n\n\u00a0\u00a0\u00a0\u00a0def insert(word):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = Trie.root\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for ch in word:\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not curr.key(ch):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr.put(ch)\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = curr.list[ord(ch) - ord('a')]\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr.flag = True\n\n\u00a0\u00a0\u00a0\u00a0@staticmethod\n\n\u00a0\u00a0\u00a0\u00a0def search(word):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = Trie.root\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for ch in word:\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if not curr.key(ch):\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return False\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0curr = curr.list[ord(ch) - ord('a')]\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0return curr.flag\n\nv = [&quot;ant&quot;, &quot;an&quot;, &quot;app&quot;, &quot;ban&quot;, &quot;bat&quot;, &quot;bell&quot;]\n\ns = [&quot;ap&quot;, &quot;apple&quot;, &quot;ban&quot;, &quot;bell&quot;]\n\nfor word in v:\n\n\u00a0\u00a0\u00a0\u00a0Trie.insert(word)\n\nfor word in s:\n\n\u00a0\u00a0\u00a0\u00a0print(&quot;True&quot; if Trie.search(word) else &quot;False&quot;)<\/pre><\/div>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code has-black-color has-text-color has-background has-link-color wp-elements-59339a0d920eaaedb1dd624067a3c0bb\" style=\"background-color:#fedcba\"><code>False\n\nFalse\n\nTrue\n\nTrue<\/code><\/pre>\n\n\n\n<p>Advantages of Trie:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Trie reduces the time to search a string or substring of any string to O(N) time complexity. Where N is the size of the longest string.<\/li>\n\n\n\n<li>It takes less space when we contain a large number of short strings.<\/li>\n\n\n\n<li>It can easily solve questions like \u201cReplace Words,\u201d \u201c<a href=\"https:\/\/leetcode.com\/problems\/design-search-autocomplete-system\/\" target=\"_blank\" rel=\"noopener\">Design Search Autocomplete System<\/a>,\u201d etc.<\/li>\n<\/ul>\n\n\n\n<p>The insertion operation takes O(N), where N is the size of each string. The space complexity for the insertion function is O(M*N) where M is the total number of times the insertion function is called.<\/p>\n\n\n\n<p>The search operation takes O(N) time complexity. The space complexity for the search function is O(1) as we are not using any space during the search operation.<\/p>\n\n\n\n<p>So, the overall time complexity is O(n), and the space complexity is O(n*m).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>In this article, we have seen how to implement a trie. If we used a <a href=\"https:\/\/favtutor.com\/blogs\/iterate-through-map-cpp\" data-type=\"link\" data-id=\"https:\/\/favtutor.com\/blogs\/iterate-through-map-cpp\">hash map<\/a> in place of a trie, we might use less space to store the strings and also less time to search for the string. However, the hash map is not as useful when we are searching for substrings, which can easily be found by a trie. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Trie is an advanced data structure used to store strings so that we can search the string in O(N) time complexity, where N is the maximum length of a string. The concept behind a trie is to store strings in a tree structure where each node has 26 child nodes, each representing a character of [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":2824,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jnews-multi-image_gallery":[],"jnews_single_post":null,"jnews_primary_category":{"id":"","hide":""},"footnotes":""},"categories":[7],"tags":[14,15],"class_list":["post-2821","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-structures-algorithms","tag-dsa","tag-leetcode"],"_links":{"self":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/2821","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/comments?post=2821"}],"version-history":[{"count":3,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/2821\/revisions"}],"predecessor-version":[{"id":7390,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/posts\/2821\/revisions\/7390"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/media\/2824"}],"wp:attachment":[{"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/media?parent=2821"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/categories?post=2821"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/favtutor.com\/articles\/wp-json\/wp\/v2\/tags?post=2821"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}