マツシタのお勉強

2017-02-03から1日間の記事一覧

Check if small binary tree T1 is a suibtree of large binary Tree T2

Problem You have two large binary tree: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of T1. A tree T2 is a subtree of T1 if there exists a node n in T1 such the the subtree of…

About LinkedList class in Java

What’s LinkedList The LinkedList class implements the List interface. The structure is Doubly-linked list in java, each node has next node and previous node. Time Complexity add(E e) function This function takes O(1) time. This is because,…

About ArrayList class in Java

What’s ArrayList The ArrayList class implements the List interface. ArrayList supports dynamic arrays that can grow as needed. Standard Java arrays are of a fixed length. After arrays are created, they cannot grow or shrink, which means th…