Skip to content

Instantly share code, notes, and snippets.

View shubham100795's full-sized avatar

shubham100795

View GitHub Profile
@shubham100795
shubham100795 / leftview.cpp
Created February 27, 2017 19:02
left view of a binary tree
#include<iostream>
#include<cstdlib>
#include<cstdio>
using namespace std;
struct node{
int data;
struct node *left;
struct node *right;
};
@shubham100795
shubham100795 / romanstointeger.cpp
Created February 26, 2017 05:43
Roman Numerals to Integer
#include<iostream>
#include<string>
using namespace std;
int getvalue(char r)
{
if (r == 'I')
return 1;
if (r == 'V')
return 5;
@shubham100795
shubham100795 / bottomview.cpp
Created February 22, 2017 14:11
print the bottom view , vertical view and top view of the BST
#include<iostream>
#include<cstdlib>
#include<queue>
#include<map>
using namespace std;
struct node{
int data;
struct node *left;
struct node *right;
@shubham100795
shubham100795 / nodesatdistk.cpp
Created February 20, 2017 17:34
print nodes at a distance 'k' from leaf nodes
#include<iostream>
#include<set>
#include<cstdlib>
using namespace std;
struct node{
int data;
struct node *left;
struct node *right;
};
@shubham100795
shubham100795 / verticalview.cpp
Last active February 22, 2017 14:12
Vertical View of a BST
#include<iostream>
#include<map>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
struct node{
int data;
struct node *left;
@shubham100795
shubham100795 / topview.cpp
Last active February 22, 2017 14:13
Top View of BST using STL library
#include<iostream>
#include<cstdlib>
#include<queue>
#include<map>
using namespace std;
struct node{
int data;
struct node *left;