Given a binary tree, count the number of nodes in each node’s left subtree, and store it in the numNodesLeft field. Examples 
 1(6) /          \ 2(3)        3(0) /      \ 4(1)     5(0) /        \        \ 6(0)     7(0)   8(0) The numNodesLeft is show…
http://cis.stvincent.edu/html/tutorials/swd/btree/btree.html Introduction A B-tree is a specialized multiway tree designed especially for use on disk. In a B-tree each node may contain a large number of keys. The number of subtrees of each node, then…
我用String代替了链表显示,本题的大意是每k个进行逆序处理,剩下的不够k个的就按照原顺序保留下来. public class ReverseNodes { public static void main(String[] args) { String str = "1->2->3->4->5->6->7->8->9->10->11->12->13->14->15"; String[] strArra…
Question Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's total elements. Follow up What if the BST is modified (insert/delete operations) often and…
目录: 01. Week01 - Lec02 - Revision and setting the scene 02. Week02 - Lec01 - Data structures - memory allocation 03. Week02 - Lec02 - Input - Output 04. Week03 - Lec01 - ADTs 05. Week03 - Lec02 - Dynamic memory allocation 06. Week04 - Lec01 - LinkedL…
Given two Binary Search Trees, find common nodes in them. In other words, find intersection of two BSTs. Example: from: http://www.geeksforgeeks.org/print-common-nodes-in-two-binary-search-trees/ Method 1 (Simple Solution) A simple way is to one by o…
Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia: In a complete binary tree every level, except possibly the last, is completely filled, and all nodes in the last level are as far left as po…
Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only nod…
问题: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the values in the nodes, only…
Reverse Nodes in k-Group Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain as it is. You may not alter the valu…