Category: A ll Codes

07
Jun
2017

Basics of Implementation – Hackerearth

Vowel count in a string: code: #include<iostream> #include<cstdio> using namespace std; int main() { int a=0,e=0,i=0,o=0,u=0; string…

07
Jun
2017

C++ Vector push_back()…pop_back()

#include<vector> #include<iostream> using namespace std; int main() { vector<string> list; cout<<“Please enter the names, press Q to…

05
Jun
2017

Algo – Linked List

Best Video Explained: code: some bugs  here but understood the implementation: #include<bits/stdc++.h> void display(void); void addatbegin(void); void…

03
Jun
2017

Algorithm: Euler’s GCD

code: int euclid_gcd(int a,int b) { int dividend,divisor,remainder; dividend = a>=b?a:b; divisor= a<=b?a:b; while(divisor!=0) { remainder=dividend%divisor; dividend=divisor;…

03
Jun
2017

Algo: Prime factorization of a number

code: #include<bits/stdc++.h> int main() { int i,n,ct=0;; scanf(“%d”,&n); for(i=2;i<=sqrt(n);i++) { if(n%i==0) { ct=0; while(n%i==0) { n=n/i; ct++;…

02
Jun
2017

Prime Number: Trial division | Prime check upto N in C

code: #include<bits/stdc++.h> int main() { int i,j,n,flag=0; printf(“enter number: “); scanf(“%d”,&n); for(i=2;i<=n;i++) //first iterate upto n {…