{"id":1098,"date":"2017-03-27T06:44:26","date_gmt":"2017-03-27T13:44:26","guid":{"rendered":"http:\/\/somethingk.com\/main\/?p=1098"},"modified":"2018-01-03T10:20:54","modified_gmt":"2018-01-03T17:20:54","slug":"sweet-binary-search-tree-print-in-c","status":"publish","type":"post","link":"https:\/\/somethingk.com\/main\/sweet-binary-search-tree-print-in-c\/","title":{"rendered":"Sweet Binary Search Tree Print in C++"},"content":{"rendered":"<section id=\"text-4\" class=\"widget boka-widget widget_text amr_widget\">\t\t\t<div class=\"textwidget\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block; text-align:center;\"\r\n     data-ad-layout=\"in-article\"\r\n     data-ad-format=\"fluid\"\r\n     data-ad-client=\"ca-pub-7619916617995509\"\r\n     data-ad-slot=\"9102150708\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script><\/div>\n\t\t<\/section>\n<p>I found the basis of a print on <a href=\"http:\/\/stackoverflow.com\/questions\/13484943\/print-a-binary-tree-in-a-pretty-way\">Stackover<\/a> flow the other day and changed it a little bit to be more compatible across compiler versions.<\/p>\n<p>Happy Coding!<\/p>\n<div class=\"snippetcpt-wrap\" id=\"snippet-1099\" data-id=\"1099\" data-edit=\"\" data-copy=\"\/main\/wp-json\/wp\/v2\/posts\/1098?snippet=17b1fac833&#038;id=1099\" data-fullscreen=\"https:\/\/somethingk.com\/main\/code-snippets\/sweetly-formatted-binary-tree-print\/?full-screen=1\">\n\t\t\t\t<pre class=\"prettyprint linenums lang-c_cpp\" title=\"Sweetly Formatted Binary Tree Print\">void print() {\r\n    print(root, 0); \/\/call it on your root\/head node\r\n}\r\n<\/pre>\n\t\t\t<\/div>\n<p>For some reason my code editor wouldn&#8217;t do the left slashes so below is a screenshot.<\/p>\n<p><a href=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.42.54-AM.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"size-full wp-image-1101 alignnone\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.42.54-AM.png\" alt=\"\" width=\"816\" height=\"384\" srcset=\"https:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.42.54-AM.png 816w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.42.54-AM-300x141.png 300w, https:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.42.54-AM-768x361.png 768w\" sizes=\"(max-width: 816px) 100vw, 816px\" \/><\/a><\/p>\n<p>Here is an example of what it will look like for the sequence <strong>5 7 4 2 1 9 8 3 6<\/strong>:<\/p>\n<p><a href=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.38.07-AM.png\"><img decoding=\"async\" class=\"size-full wp-image-1100 alignnone\" src=\"http:\/\/somethingk.com\/main\/wp-content\/uploads\/2017\/03\/Screen-Shot-2017-03-27-at-7.38.07-AM.png\" alt=\"\" width=\"142\" height=\"297\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I found the basis of a print on Stackover flow the other day and changed it a little bit to be more compatible across compiler versions. Happy Coding! For some reason my code editor wouldn&#8217;t do the left slashes so below is a screenshot. Here is an example of what it will look like for the sequence 5 7 4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1100,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[177],"tags":[497,564,539,303,476,562,510,563],"class_list":["post-1098","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","tag-binary-tree","tag-branches","tag-bst","tag-c","tag-cool","tag-formatted","tag-print","tag-visible"],"_links":{"self":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1098","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/comments?post=1098"}],"version-history":[{"count":3,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1098\/revisions"}],"predecessor-version":[{"id":1113,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/posts\/1098\/revisions\/1113"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/media\/1100"}],"wp:attachment":[{"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/media?parent=1098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/categories?post=1098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/somethingk.com\/main\/wp-json\/wp\/v2\/tags?post=1098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}