Monday, 28 December 2015

Extended Euclid Algorithm


Friday, 25 December 2015

C++ Interview Questions-Set 2


Saturday, 31 October 2015

Occurence of a number in Sorted Array/Vector using Recursion

 #include<iostream>  
 #include<vector>  
 using namespace std;  
 int Frequency(std::vector<int> &v, int k, int start, int end)  
 {  
   if (start > end)  
     return 0;  
   int mid = (start + end) / 2;  
   if (v[mid] < k)  
     return Frequency(v, k, mid + 1, end);  
   if (v[mid] > k)  
     return Frequency(v, k, start, mid - 1);  
   return Frequency(v, k, start, mid - 1) + 1 + Frequency(v, k, mid + 1, end);  
 }  
 int main()  
 {  
   int arr[] ={2,2,3,3,5,5,5};//Sorted Array  
   std::vector<int> v(arr, arr+7);  
   int k;  
   std::cin>>k;  
   std::cout<<Frequency(v, k, 0, v.size()-1);  
   getchar();  
 }  

Sunday, 18 October 2015

grep - Linux Command

Most of the general linux commands are available online but here i will be covering bit advance feature of some linux commands

grep

We use grep command to search contents in a file or directory.What will be command for searching only in specific extension files in a directory.Lets find out below
  • Recursively Search a pattern in all files of a directory use
        grep -R "Pattern to Search" /DirectoryPath
  • To Search a pattern only in files with specific extensions in a directory use
        grep -R --include=*.xml "Pattern to Search" /DirectoryPath
  • To Search a pattern in files with multiple extensions in a directory use
        grep -R --include=*.{xml,sh,html} "Pattern to Search" /DirectoryPath

  • Case insensitive Search of a pattern
        grep -iR  "Pattern to Search" /DirectoryPath

Saturday, 29 August 2015

Technical Things to Know

  • Distributed Objects refers to software modules that are designed to work together, but reside either in multiple computers connected via a network or in different processes inside the same computer. 
  • DCOM is a framework for distributed objects on the Microsoft platform.

Friday, 31 July 2015

auto_ptr

Note: auto_ptr has been deprecated in C++11 and unique_ptr has taken its place.

Thursday, 14 May 2015

Best Example of Recursion



Most of us face problem understanding recursion. I found one of the beautiful example for us to understand recursion
  1. Open VLC Media Player
  2. Press Ctrl+N
  3. Type “screen://”  in the opened window
  4. Click Play to see this VLC recursion effect