This file contains 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
//find the second best | |
#include<stdio.h> | |
int main() | |
{ | |
int a[7]={1,8,5,7,10,11,2}; | |
int max,sec_max; |
This file contains 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<malloc.h> | |
struct node | |
{ | |
int data; | |
struct node* left; | |
struct node* right; | |
}; |
This file contains 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 <string.h> | |
// hashTable[i] stores all characters that correspond to digit i in phone | |
const char hashTable[10][5] = {"", "", "abc", "def", "ghi", "jkl", | |
"mno", "pqrs", "tuv", "wxyz"}; | |
// A recursive function to print all possible words that can be obtained | |
// by input number[] of size n. The output words are one by one stored | |
// in output[] |
This file contains 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> | |
/* structure of a stack node */ | |
struct sNode | |
{ | |
int data; | |
struct sNode *next; | |
}; | |
This file contains 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> | |
/* structure of a stack node */ | |
struct sNode | |
{ | |
int data; | |
struct sNode *next; | |
}; | |
This file contains 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 key; | |
struct node *left, *right; | |
}; | |
// A utility function to create a new BST node |
This file contains 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
//hashmap phone keypad | |
#include <stdio.h> | |
#include <string.h> | |
int main() | |
{ | |
char str[]="facebook"; |
This file contains 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 <limits.h> /* For INT_MAX */ | |
/* Function to print first smallest and second smallest elements */ | |
void print2Smallest(int arr[], int arr_size) | |
{ | |
int i, first, second; | |
/* There should be atleast two elements */ | |
if (arr_size < 2) |
This file contains 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
//first non repeating chaarcter in a string | |
#include <stdio.h> | |
#include <string.h> | |
char firstNon(char str[]) | |
{ | |
int count[256]={0}; | |
int i; |
This file contains 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
//binary tree where each node has some weight. | |
//you have to return the max weight int the binary tree | |
#include <stdio.h> | |
#include <malloc.h> | |
struct node | |
{ | |
int data; |
OlderNewer