Skip to content

Instantly share code, notes, and snippets.

View nihal-singh's full-sized avatar
📚
Always Learning !

NIHAL SINGH nihal-singh

📚
Always Learning !
View GitHub Profile
@nihal-singh
nihal-singh / SpeectToText and LanguageTranslator.ipynb
Last active August 26, 2020 12:39
Coursera Python For Data Science Course
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nihal-singh
nihal-singh / PY0101EN-5.1_Intro_API.ipynb
Created August 26, 2020 08:57
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nihal-singh
nihal-singh / Numpy1D.ipynb
Last active August 26, 2020 12:42
Coursera Python For data Science
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class Solution {
public int removeDuplicates(int[] nums) {
int len = nums.length; // calculate length of the array.
if(len == 0 || len == 1)return len; // return length if array has zero or only one element.
int lastMem = nums[0]; // stores the element that is not duplicate
int count = 1; //return count at last so as to get the unique element count
int index = 1;
/* C++ program to find Inorder successor in a BST */
#include<iostream>
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
};
//Function to find some data in the tree
/* Deleting a node from Binary search tree */
#include<iostream>
using namespace std;
struct Node {
int data;
struct Node *left;
struct Node *right;
};
//Function to find minimum in a tree.
Node* FindMin(Node* root)
//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);
/* Binary Tree Traversal - Preorder, Inorder, Postorder */
#include<iostream>
using namespace std;
struct Node {
char data;
struct Node *left;
struct Node *right;
};
/* Binary tree - Level Order Traversal */
#include<iostream>
#include<queue>
using namespace std;
struct Node {
char data;
Node *left;
Node *right;
};