Monday 20 June 2016

Introduction to GitHub:An Open Source Community for Developers

Most of us have heard about GitHub as an open Source Community for Developers, but what does it actually means and how we can get started to use one of the popular platform used by many developers to make contribution to open source projects. So let’s get started,


GitHub is a Version Controlled System mainly used for source codes. In simple words, It can be used by developers to put there codes of project at one place which can be accessed easily by there teammates. So they can change the code as per there requirements and get the job done easily. I know many of us will be confused due to this so let’s take an example.

Suppose, in college you are working on Group project with your team members. You have divided your tasks in your team. Now you have finished your task and want to combine your work with the remaining work done by your team members. For that you asked your team for project codes and they given you.but suddenly you realized that you have to make some changes to your own work but it will be difficult task for you to do that work again from certain point which also affects the work of your teammates.

Therefore imagine a situation where you have one copy of your project which can be accessed by all of your team members so that they can make required changes without affecting previous code, it will be very easy as compared to your method. So here comes a GitHub. With the help of github we can put our projects folders on web, can make changes to source codes and access these changes by retrieving it to your local system by using command line tool known as Git. It consists of some commands in order to push your projects on GitHub server, make changes to your project files and pull back those changes back to your local folder.for more information about how to use github command line tool,go to



You can also download the different projects provided by different developers and organisations and can contribute to there project by providing bug fixes, error corrections or by adding new features.

Here are some references for getting started with Github.






Friday 3 June 2016

How to improve battery performance of your laptop.


Hey everyone,Sometimes you have been facing problem of draining your laptop battery very quickly.
 So, today we are going to see some ways to extend battery life of your laptop.
1.  Switch to Power Options:
This can be done by right clicking on battery icon present at right side on Taskbar. There are some options like,


Balanced (Recommended):  It is in-built Recommended options but truly speaking its minimize battery’s life. The energy consumption with hardware is responsible for this.so avoid this power option.
Power Saver: This option save energy by reducing your computers performance wherever possible. Also the heating issues faced by most of us is also reduced, so it is highly recommended to use Power saver. Approximately It increases time up to 45 to 50 minutes compared to Balanced mode.
High Performance: This is usually of no need because its drain your battery by consumption of energy.
You can also change plan settings by clicking on link as shown above, but it is optional and the options they specified are enough.


       2. Improve performance of your laptop:
You also need to optimize performance of your laptop or PC in order to run it smoothly. This can be done by cleaning the temporary files by pressing windows +X  then select run option like,

  
Then type %TEMP% in run and by clicking OK you will see temp files on your screen. Delete all files permanently by pressing shift+del . Now you can observe performance increased in some manner.

       3. Disk cleanup:
It is another way to improve performance of your system by cleaning junk files. This can be done by à
Go to My Computer àLocal Disk C(Drive)àright click on C drive and Go to property like,
Then choose Disk cleanup and window will popup like this ,

Then select file to be cleaned up and click ok. In this way unnecessary files will be deleted which enhances system performance.



 Some Useful tips:
Never charge your laptop to 100%, it makes cell of your battery weaken. And make sure to remove plug when battery charges upto 80-85%.
It is not a good idea to work on your laptop when you are charging it. Also close the un-necessary applications that are running in the background by using Task Manager.
Don’t use screen savers, it drains battery very fast.
Make sure to clean battery by using dry cloth or with the help of cotton wools atleast once in month.
So by following these above simple steps you will significantly see the performance is improved of your laptop.
  




Sunday 15 May 2016

Program For Binary Search By Iterative and Recursive way.

In Binary search algorithm, we are going to divide a given array into two parts and solve these parts iteratively.For this we are going to find mid element and compare it with element to be found. if it is found we are going to return position i.e(mid element). If element to be found is greater than mid then we are going to set lower bound to mid+1. If element to be found is less than mid then we are going to set upper bound to mid-1. 

Program By Iterative way:
#include<stdio.h>
void main()
{
   
    int arr[20],i,n;
    int h,l,mid,x;
    printf("Enter no. of elements");
    scanf("%d",&n);
    printf("\nEnter array Elements:");
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }
   
    printf("\nEnter no. to be searched:");
    scanf("%d",&x);
    l=0;
    h=n-1;
    mid=(l+h)/2;
    while(l<=h)
    {
        if(arr[mid]==x)
        {
            printf("\nElements found at %d Position\n",mid);
            break;   
        }
           
            if(x>arr[mid])   
            {
                l=mid+1;
            }
            if(x<arr[mid])
            {
                h=mid-1;
            }
       
    } 

}

Program:By Recursive Way
#include<stdio.h>
int main()
{
    int arr[20];
    int i,n;
    int h,l,mid,x;
    int result;
    printf("Enter number of elements:");
    scanf("%d",&n);
    printf("Enter array elements:");
    for(i=0;i<n;i++)
    {
        scanf("%d",&arr[i]);
    }
    l=0;
    h=n-1;
    printf("enter element to be searched:");
    scanf("%d",&x);
    result=BinarySearch(arr,l,h,x);
    printf("Element found at %d Position",result);
    return(0);

}
int BinarySearch(int arr[],int l,int h,int x)
{
    while(l<=h)
    {
        int mid=(l+h)/2;
        if(arr[mid]==x)
        {
            return(mid);
            break;
        }
        if(x>arr[mid])
        {
        return(BinarySearch(arr,mid+1,h,x));
        }
        if(x<arr[mid])
        {
            return(BinarySearch(arr,l,mid-1,x));
        }
    }
   
}
Note:
The Time Complexity By Iterative way is O(n).
The Time Complexity by Recursive way is  \Theta(Logn).

Saturday 14 May 2016

Worst Case,Best Case and Average Case Efficiency using Insertion Sort.

Insertion Sort is based on inserting a single element in the right for a given iteration.

#include<stdio.h>
void sortArray(int arr[],int n)
{
int i,temp,j;
for(i=0;i<n;i++)
{
temp=arr[i];
j=i-1;

while(j>=0 && arr[j]>temp)
{
arr[j+1]=arr[j];
j--;

}
arr[j+1]=temp;

}
}
void printArray(int arr[], int n)
{
   int i;
   for (i=0; i < n; i++)
       printf("%d ", arr[i]);
   printf("\n");
}

int main()
{
int i;
int arr[]={12, 11, 13, 5, 6};

int n=sizeof(arr);
printf("Given Array is:");
for(i=0;i<n;i++)
{
printf("%d\n",arr[i]);
}
sortArray(arr,n);
printArray(arr,n);
}

Explanation:

Best Case:If an input array is already Sorted. The time complexity will be O(n).
Worst Case:If the array is sorted in reverse order.In this case Time Complexity will be O(n2).
Average Case:If the input array consist of random numbers.The Time Complexity is O(n2).

Worst Case,Best Case and Average Case Efficiency using Linear Search.

Time complexities of any algorithm can be expressed by using best,Worst and Average case.
The Time Complexity of Linear Search is shown By using Program.

//Linear search program

#include<stdio.h>
int main()
{
int arr[]={1,10,30,40,50,60,77,56,57};
int x=57;
int n=sizeof(arr);
printf("Element %d is found at %d",x,search(arr,n,x));
return(0);

}
int search(int arr[],int n,int x)
{
int i;
for(i=0;i<n;i++)
{
if(arr[i]==x)
return(i);
}
return(-1);

}

Explanation:
// Worst case of this algorithm will be Θ(n) if element will be found at last position.
//For Average case,we have to search for all the inputs(taking sum of all inputs) and then divide it by no.of inputs.
i.e.
= Θ(n)
// Best case will occur when element will be found at first position.Best Case means how fast the algorithm can run