{"id":19919,"date":"2023-01-19T07:12:50","date_gmt":"2023-01-19T07:12:50","guid":{"rendered":"https:\/\/www.booksofall.com\/ru\/?post_type=product&#038;p=19919"},"modified":"2023-01-19T07:12:50","modified_gmt":"2023-01-19T07:12:50","slug":"the-great-tree-list-recursion-problem","status":"publish","type":"product","link":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/","title":{"rendered":"The Great Tree-List Recursion Problem"},"content":{"rendered":"<h2>Introduction<\/h2>\n<p>The problem will use two data structures &#8212; an ordered binary tree and a circular doubly linked list. Both data structures store sorted elements, but they look very different.<\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Binary_search_tree\"><strong>Ordered Binary Tree<\/strong><\/a><\/p>\n<p>In the ordered <a href=\"https:\/\/www.freecodecamp.org\/news\/binary-search-trees-bst-explained-with-examples\/\">binary tree<\/a>, each node contains a single data element and &#8220;small&#8221; and &#8220;large&#8221; pointers to sub-trees (sometimes the two pointers are just called &#8220;left&#8221; and &#8220;right&#8221;).<\/p>\n<p><em>Figure-1 &#8212; ordered binary tree<\/em><\/p>\n<p>All the nodes in the &#8220;small&#8221; sub-tree are less than or equal to the data in the parent node. All the nodes in the &#8220;large&#8221; sub-tree are greater than the parent node. So in the example above, all the nodes in the &#8220;small&#8221; sub-tree off the 4 node are less than or equal to 4, and all the nodes in &#8220;large&#8221; sub-tree are greater than 4. That pattern applies for each node in the tree. A null pointer effectively marks the end of a branch in the tree. Formally, a null pointer represents a tree with zero elements. The pointer to the topmost node in a tree is called the &#8220;root&#8221;.<\/p>\n<p><a href=\"https:\/\/www.geeksforgeeks.org\/insertion-in-doubly-circular-linked-list\/\"><strong>Circular Doubly Linked List<\/strong><\/a><\/p>\n<p><em>Figure-2 &#8212; doubly linked circular list<\/em><\/p>\n<p>The circular doubly linked list is a standard linked list with two additional features&#8230;<\/p>\n<p>&#8220;<a href=\"https:\/\/www.educative.io\/m\/convert-binary-tree-to-doubly-linked-list\">Doubly linked<\/a>&#8221; means that each node has two pointers &#8212; the usual &#8220;next&#8221; pointer that points to the next node in the list and a &#8220;previous&#8221; pointer to the previous node. &#8220;Circular&#8221; means that the list does not terminate at the first and last nodes. Instead, the &#8220;next&#8221; from the last node wraps around to the first node. Likewise, the &#8220;previous&#8221; from the first node wraps around to the last node.<\/p>\n<p>We&#8217;ll use the convention that a null pointer represents a list with zero elements. It turns out that a length-1 list looks a little silly&#8230;<\/p>\n<p><em>Figure-3 &#8212; a length-1 circular doubly linked list<\/em><\/p>\n<p>The single node in a length-1 list is both the first and last node, so its pointers point to itself. Fortunately, the length-1 case obeys the rules above so no special case is required.<\/p>\n<p>The Trick &#8212; Separated at Birth? Here&#8217;s the trick that underlies the Great Tree-List Problem: look at the nodes that make up the ordered binary tree. Now look at the nodes that make up the linked list. The nodes have the same type structure &#8212; they each contain an element and two pointers. The only difference is that in the tree, the two pointers are labeled &#8220;small&#8221;&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p><iframe style=\"width: 100%; height: 750px; border: none;\" src=\"https:\/\/online.visual-paradigm.com\/share\/book\/the-great-tree-list-recursion-problem-with-license-185w7wquu8?p=1\" frameborder=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n","protected":false},"featured_media":19929,"template":"","meta":{"_yoast_wpseo_title":"","_yoast_wpseo_metadesc":"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!"},"product_brand":[],"product_cat":[263],"product_tag":[],"class_list":{"0":"post-19919","1":"product","2":"type-product","3":"status-publish","4":"has-post-thumbnail","6":"product_cat-algorithms-data-structures","8":"first","9":"instock","10":"shipping-taxable","11":"product-type-simple"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Great Tree-List Recursion Problem - BooksOfAll Russian<\/title>\n<meta name=\"description\" content=\"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/\" \/>\n<meta property=\"og:locale\" content=\"ru_RU\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Great Tree-List Recursion Problem - BooksOfAll Russian\" \/>\n<meta property=\"og:description\" content=\"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/\" \/>\n<meta property=\"og:site_name\" content=\"BooksOfAll Russian\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg\" \/>\n<meta name=\"twitter:label1\" content=\"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 \u043c\u0438\u043d\u0443\u0442\u044b\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/\",\"url\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/\",\"name\":\"The Great Tree-List Recursion Problem - BooksOfAll Russian\",\"isPartOf\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg\",\"datePublished\":\"2023-01-19T07:12:50+00:00\",\"description\":\"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#breadcrumb\"},\"inLanguage\":\"ru-RU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage\",\"url\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg\",\"contentUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg\",\"width\":\"827\",\"height\":\"1169\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.booksofall.com\/ru\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Categories\",\"item\":\"https:\/\/www.booksofall.com\/ru\/categories\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"The Great Tree-List Recursion Problem\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#website\",\"url\":\"https:\/\/www.booksofall.com\/ru\/\",\"name\":\"BooksOfAll Russian\",\"description\":\"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.\",\"publisher\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.booksofall.com\/ru\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ru-RU\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#organization\",\"name\":\"BooksOfAll Russian\",\"url\":\"https:\/\/www.booksofall.com\/ru\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ru-RU\",\"@id\":\"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png\",\"contentUrl\":\"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png\",\"width\":166,\"height\":30,\"caption\":\"BooksOfAll Russian\"},\"image\":{\"@id\":\"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Great Tree-List Recursion Problem - BooksOfAll Russian","description":"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/","og_locale":"ru_RU","og_type":"article","og_title":"The Great Tree-List Recursion Problem - BooksOfAll Russian","og_description":"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!","og_url":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/","og_site_name":"BooksOfAll Russian","og_image":[{"url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_image":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg","twitter_misc":{"\u041f\u0440\u0438\u043c\u0435\u0440\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f":"2 \u043c\u0438\u043d\u0443\u0442\u044b"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/","url":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/","name":"The Great Tree-List Recursion Problem - BooksOfAll Russian","isPartOf":{"@id":"https:\/\/www.booksofall.com\/ru\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage"},"image":{"@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage"},"thumbnailUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg","datePublished":"2023-01-19T07:12:50+00:00","description":"Do you know the difference between ordered binary tree and a circular doubly linked list? Learn more about these 2 data structure in this book!","breadcrumb":{"@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#breadcrumb"},"inLanguage":"ru-RU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/"]}]},{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#primaryimage","url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg","contentUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2023\/01\/cover-Copy-of-Page-10.jpg","width":"827","height":"1169"},{"@type":"BreadcrumbList","@id":"https:\/\/www.booksofall.com\/ru\/the-great-tree-list-recursion-problem\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.booksofall.com\/ru\/"},{"@type":"ListItem","position":2,"name":"Categories","item":"https:\/\/www.booksofall.com\/ru\/categories\/"},{"@type":"ListItem","position":3,"name":"The Great Tree-List Recursion Problem"}]},{"@type":"WebSite","@id":"https:\/\/www.booksofall.com\/ru\/#website","url":"https:\/\/www.booksofall.com\/ru\/","name":"BooksOfAll Russian","description":"Biggest IT eBooks library and learning resources - Free eBooks for programming, computing, artificial intelligence and more.","publisher":{"@id":"https:\/\/www.booksofall.com\/ru\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.booksofall.com\/ru\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ru-RU"},{"@type":"Organization","@id":"https:\/\/www.booksofall.com\/ru\/#organization","name":"BooksOfAll Russian","url":"https:\/\/www.booksofall.com\/ru\/","logo":{"@type":"ImageObject","inLanguage":"ru-RU","@id":"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/","url":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png","contentUrl":"https:\/\/www.booksofall.com\/ru\/wp-content\/uploads\/sites\/7\/2022\/06\/booksofall-logo-2.png","width":166,"height":30,"caption":"BooksOfAll Russian"},"image":{"@id":"https:\/\/www.booksofall.com\/ru\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product\/19919","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product"}],"about":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/types\/product"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/media\/19929"}],"wp:attachment":[{"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/media?parent=19919"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_brand?post=19919"},{"taxonomy":"product_cat","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_cat?post=19919"},{"taxonomy":"product_tag","embeddable":true,"href":"https:\/\/www.booksofall.com\/ru\/wp-json\/wp\/v2\/product_tag?post=19919"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}