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 insert(trie *t, char key[]){ | |
| int len = strlen(key); | |
| int i; | |
| if(t->root == NULL){ | |
| printf("\n Trie is not initialized\n"); | |
| } | |
| Node * current = t->root; |
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 search(trie *t, char key[]){ | |
| int len = strlen(key); | |
| int i; | |
| if(t->root == NULL){ | |
| printf("\n Trie is not initialized\n"); | |
| } | |
| Node * current = t->root; | |
| for(i=0; i<len; i++){ | |
| int index = GET_CHAR_INDEX(key[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> | |
| /* This function reverses the whole string */ | |
| void reverse(char s[]){ | |
| int i=0, j; | |
| int end = strlen(s); | |
| for(i=0, j=end-1; i<j; i++, j--){ | |
| char temp = s[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
| void reverse_array(int a[], int start, int end){ | |
| while(start < end){ | |
| int temp = a[start]; | |
| a[start] = a[end]; | |
| a[end] = temp; | |
| start++; | |
| end--; | |
| } |
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> | |
| 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
| #include<stdio.h> | |
| #include<stdlib.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
| #include<stdlib.h> | |
| #include<stdio.h> | |
| typedef struct node{ | |
| int data; | |
| struct node *next; | |
| } Node; | |
| Node * merge_sort(Node *a, Node *b){ | |
| Node *result = NULL; |
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 matrix multiplication(int p[], int N){ | |
| int L,i, j, temp; | |
| int M[N+1][N+1]; | |
| for(i=0;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<stdlb.h> | |
| #include<stdio.h> | |
| #define true 1 | |
| #define false 0 | |
| int isSubsetSum(int arr[], int n, int sum, int subset[], int count){ | |
| int i; | |
| if(sum == 0) { | |
| 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<stdlb.h> | |
| #include<stdio.h> | |
| int isSubsetSum1(int arr[], int n, int sum) | |
| { | |
| /* The value of subset[i][j] will be true if there is a | |
| subset of set[0..j-1] */ | |
| int subset[sum+1][n+1]; | |
| int i,j; | |