Monday, December 12, 2016

Combination Algorithms



1. Longest Common Subsequence


2. Tower Of Hanoi


3. Tower of Hanoi program in java




Friday, December 9, 2016

SUBSET/COMBINATION Generating and coding.

In this video we will discuss about the idea behind generating combination/subset from the give set. Here the set can be a string, Each character is considered as single element.






Sunday, October 2, 2016

Longest Common Subsequence

Longest Common Sub-Sequence


Idea behind the logic is

1. If the two string's first character is same then truncate both and use the truncated string and proceed.
2. if the first two character is not same then, first truncate one character from string s1 and call the function, then truncate the character from string s2 and call the function again. and take the max from that.
 


#include <stdio.h>
#include <strings.h>
#define MAX(x, y) (((x) > (y)) ? (x) : (y))
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

int lcs(char *s1, char *s2) {

 if (strlen(s1) == 0 || strlen(s2) == 0) 
  return 0;

 if (*s1 == *s2) {

  return 1+lcs(s1+1, s2+1);
 }
 else {

  return MAX(lcs(s1+1, s2), lcs(s1, s2+1));
 }
}

int main() {

 char s2[] = "abcd";
 char s1[] = "efgh";

 printf("%d\n", strlen(s2));

 int c = lcs(s1, s2);

 printf("%d   count = %d\n", c, count);
}

Wednesday, January 13, 2016

Javascript Programming Language



















Monday, October 26, 2015

 Swift Programming Langauge



































Monday, April 27, 2015

Data Structure and Algorithms - Binary Search Tree



BST - Insert
Here we discussed about, what is binary tree and what properties makes binary search tree. theory of binary search tree and the actual implementation.

BST - Delete
Here we discuss about what are cases we need to consider before deleting a node and how to make the binary tree properties intact after deleting the node.

Count Number of elements in the given binary tree, I will be explaining how to do this programatically and hands on coding as well.

              

In the below video I am going to explain you how to find the smallest and largest element in the given binary tree.