Implement a function similar to diff command in linux

Problem Give logic for implementing “diff” command in Linux. Consider various test cases and explain what will happen in each. The two files are source code and are huge.. For e.g. File 1: 1-2-3-4 File 2: 1-3-4-2 Solution The operation of diff is based on solving the longest common sub-sequence problem. In this problem, you have two sequences of items: a b c d f g h j q z [Read More]

Given the post order array find if tree is BST

Problem An array which is a Post order traversal of a Binary Tree. Write a function to check if the Binary Tree formed from the array is a Binary Search Tree. Eg: 2 1 3 The array given as input would be 1 3 2. Write a function to say if the tree formed is a Binary Search Tree. Example 2: 4 is root. 0 is left child of 1 , 1 is left child of 2 and 2 is left child of 4. [Read More]