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
/* | |
Evaluation Of postfix Expression in C++ | |
Input Postfix expression must be in a desired format. | |
Operands must be integers and there should be space or comma in between two operands. | |
Only '+' , '-' , '*' and '/' operators are expected. | |
*/ | |
#include<iostream> | |
#include<stack> | |
#include<string> |
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
* git init -initialise a new git repository | |
[initially the new repository contains 0 commits] | |
[commit is a snapshot of git repository] | |
* git log - log of previous commits | |
['head' is the git name for current commit] | |
* git log -n 2 - shows only last 2 commits [n here means number] | |
* git log --graph --oneline master coins - [this will log the commits in one line (master and coins are the branch names) ] |
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
Setting a remote repository on github | |
----------------------------------------- | |
* git remote - view current remotes | |
* git remote add origin https_repo_url - we can give any name instead of origin,it is the name in repo to refer to repo on github. | |
* git remote -v - To verify that the repo url was added correctly [v-verbose,provides more info] | |
* git push origin master - git push is used to push the local repo to github(remote) | |
[it takes two arguments - the remote I want to send changes to and name of local branch to push.] | |
* git pull origin master - git pull is used to pull the changes of the remote repo to the local directory. | |
* git fetch - fetches the remote commit of the branch to the local copy of the repository .we can then compare the commit made to the | |
local repo with the commit made remotely. |
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
def createExamples(): | |
createFile = open('exFile.txt','a') | |
numberEx = range(0,10) #0.1,1.1,2.1 | |
numberVer = range(1,10) #0.1,0.2,0.3 | |
for eachNum in numberEx: | |
for eachVer in numberVer: | |
imgFilePath = 'images/numbers/'+str(eachNum)+'.'+str(eachVer)+'.png' #create image path | |
i = Image.open(imgFilePath) | |
iar = np.array(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
// Infix to Postfix Expression | |
#include <iostream> | |
#include <string> | |
#include <stack> | |
using namespace std; | |
//********************************************* | |
//function to convert Infix to PPostfix | |
string InfixToPostfix(string ); |
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
tree - used to store heirarchical data( a non linear data structure) | |
collection of entities called nodes linked together to form a heirarchy. | |
depth of node (x) - no of edges b/w root and x | |
height of node - number of edges in longest path from node to leaf node. | |
height of tree = height of root | |
applications | |
storing natural heirarchical dat i.e , file system on computer | |
organise data for quick search insertion and deletion.ex - binary search tree | |
trie is used dictionaries |
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 Search Tree - Implemenation in C++ | |
// Simple program to create a BST of integers and search an element in it | |
#include<iostream> | |
using namespace std; | |
//Definition of Node for Binary search tree | |
struct BstNode { | |
int data; | |
BstNode* left; | |
BstNode* 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
/* Binary tree - Level Order Traversal */ | |
#include<iostream> | |
#include<queue> | |
using namespace std; | |
struct Node { | |
char data; | |
Node *left; | |
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
/* Binary Tree Traversal - Preorder, Inorder, Postorder */ | |
#include<iostream> | |
using namespace std; | |
struct Node { | |
char 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
//Pseudo code to check whether a binary tree is Binary Search Tree or not | |
bool checkBST(Node* root,int min,int max){ | |
if(root == NULL)return true; | |
if(root->data > min && root->data < max && checkBST(root->left,min,root->data) && checkBST(root->right,root->data,max)) | |
return true; | |
else return false; | |
} | |
isBST(Node* root){ | |
return checkBST(root, INT_MIN, INT_MAX); |
OlderNewer