This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdlib.h> | |
| #include<stdio.h> | |
| int PossiblePaths(int m,int n){ | |
| int Table[m][n]; | |
| int i,j; | |
| for(i=0;i<=m; i++){ | |
| Table[i][0] =1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int PossiblePaths(int m,int n){ | |
| int Table[n]; | |
| int diagonal_sum =0; | |
| int i,j; | |
| for(i=0;i<=n; i++){ | |
| Table[i] =1; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| #include <math.h> | |
| void zero_subarray(int a[], int n){ | |
| int i, j; | |
| int T[n]; | |
| T[0] = a[0]; | |
| for(i= 1; i<n; i++){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| #include <math.h> | |
| /* This function heapifies heap after removal of root | |
| or at time of building heap from an array */ | |
| void max_heapify_ptr(heap_node * a[], int i, int len){ | |
| int largest =i; | |
| int left, right; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Current window : 1 4 5 6 3 | |
| 4 Minimum elements in current window : 5 4 3 1 | |
| Current window : 4 5 6 3 2 | |
| 4 Minimum elements in current window : 5 3 4 2 | |
| Current window : 5 6 3 2 4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int balancePartition(int set[], int n) | |
| { | |
| /*The value of subset[i][j] will be true if there is a subset | |
| of set[0..j-1] with sum equal to i */ | |
| int i,j; | |
| int sum =0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void printTreeLevel_iter1(Node *root){ | |
| int h = height(root); | |
| int i; | |
| int ltr = 1; | |
| for(i =1; i<=h; i++){ | |
| printf("\n Level %d :", i); | |
| /* initially passing it to left to right */ | |
| zigzagRec(root, i, ltr); | |
| /* For next iteration (level), it will be reversed */ | |
| ltr = !ltr; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void zigzag(Node * root){ | |
| stack s1, s2; | |
| s1.top = -1; | |
| s2.top = -1; | |
| if(root == NULL ) return; | |
| push(&s1, root); | |
| while(!is_empty(s1) || !is_empty(s2)){ | |
| printf("\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include<stdio.h> | |
| #include<stdlib.h> | |
| #include<math.h> | |
| struct node{ | |
| int value; | |
| struct node *left; | |
| struct node *right; | |
| }; | |
| typedef struct node Node; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define MAX_SIZE 26 | |
| #define GET_CHAR_INDEX(ch)\ | |
| ((int) ch - (int)'a' ) | |
| #define LEAF_NODE 1 | |
| #define true 1 | |
| #define false 0 | |
| typedef struct trie_node_t { |