Husen's Code
Here I will share my source code
Count 1's in a sorted Binary Array // count 1's in a sorted Binary array # include < iostream > int Co…
Read moreFinding the Last Occurrence of the element Finding the Last Occurrence of the element in an given arra…
Read moreBINARY SEARCH # include < iostream > int BinarySearch ( int arr [], int n , int x ) { int low = 0…
Read more# include < iostream > int findMajority ( int arr [], int n ) { // here the code goes int res = …
Read moreFinding leaders in an array Here I have written the Two approach one is naive approach which will take O(n^2) time com…
Read moreMoving Zeros to end in an array # include < iostream > void display ( int arr [], int n ) { std :: cout …
Read moreReverse an array arr[] = {a, b, c, .......}; # include < iostream > int reverse ( int arr [], int size ) { …
Read more----Naive approach---- # include < iostream > bool ifsorted ( int arr [], int size ) { for ( int i …
Read moreNaive approach # include < iostream > // naive solution 2 times traversal of the array; int getlargest ( int …
Read more#include <iostream> int getlargest(int arr[], int n) { int res = 0; for (int i = 1; i < n; i++) { if…
Read moreCheck for k th bit; I have solved the problem in two ways 1] Using left shift operator (<<); 2] Using right shif…
Read more
Social Plugin