• ## PAT A1167 Cartesian Tree (30point(s))

A Cartesian tree is a binary tree constructed from a sequence of distinct numbers. The tree is heap-ordered, and an inorder traversal returns the orig

查看全文
• ## PAT A1159 Structure of a Binary Tree (30point(s))

Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, a binary tree can be u

查看全文
• ## PAT A1086 Tree Traversals Again (25point(s))

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the

查看全文
• ## PAT A1099 Build A Binary Search Tree (30point(s))

A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes w

查看全文
• ## PAT A1147 Heaps (30point(s))

In computer science, a heap is a specialized tree-based data structure that satisfies the heap property: if P is a parent node of C, then the key (the

查看全文
• ## PAT A1143 Lowest Common Ancestor (30point(s))

The lowest common ancestor (LCA) of two nodes U and V in a tree is the deepest node that has both U and V as descendants.A binary search tree (BST) is

查看全文
• ## PAT A1138 Postorder Traversal (25point(s))

Suppose that all the keys in a binary tree are distinct positive integers. Given the preorder and inorder traversal sequences, you are supposed to out

查看全文
• ## PAT A1135 Is It A Red-Black Tree (30point(s))

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either

查看全文
• ## PAT A1130 Infix Expression (25point(s))

Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses reflecting the precedences of the operat

查看全文
• ## PAT A1127 ZigZagging on a Tree (30point(s))

Suppose that all the keys in a binary tree are distinct positive integers. A unique binary tree can be determined by a given pair of postorder and ino

查看全文