Pages
Categories
Meta
Category Archives: Data Structures
Efficient Algorithm for finding Longest Increasing Subsequence
Longest Increasing Subsequence(LIS) problem is to find a subsequence of a given sequence in which the subsequence’s elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily … Continue reading
Connect nodes at the same level for a generic Binary tree using constant space
Algorithm 1) Take a pointer curr(points to root) 2) Loop while curr!=NULL 3) Take 2 more pointers to keep track of prev and next(initially NULL) nodes 4) In a nested while loop traverse each level one by one 4) Update … Continue reading