Algorithm to find leaders in an array An element in an array X is called a leader if it is greater than all
  elements to the right of it in X. The best algorithm to find all
  leaders in an array.
  
  
  Solves it in linear time using a left to right pass of the array
  Solves it in linear time using a right to left pass of the array
  Solves it using divide and conquer in time \$Θ(n \log n)\$
  Solves it in time \$Θ(n^2)\$
  


At the start the right most element will always be a leader. If an element is greater than our current_max, it will a leader. Add this element to leaders. Set current_max to this element and carry on leftward. Time complexity would be \$O(n)\$.

Can you give an algorithm for another way or better way to find leader in an array?

#include &lt;iostream&gt;
using namespace std;

/* C++ Function to print leaders in an array */
void printLeaders(int arr[], int size)
{
    int max_from_right =  arr[size-1];

    /* Rightmost element is always leader */
    cout &lt;&lt; max_from_right &lt;&lt; " ";

    for (int i = size-2; i &gt;= 0; i--)
    {
        if (max_from_right &lt; arr[i])
        {           
            max_from_right = arr[i];
            cout &lt;&lt; max_from_right &lt;&lt; " ";
        }
    }    
}

/* Driver program to test above function*/
int main()
{
    int arr[] = {16, 17, 4, 3, 5, 2};
    int n = sizeof(arr)/sizeof(arr[0]);
    printLeaders(arr, n);
    return 0;
}
First off this is a C solution there is nothing inherently C++ about this code. You just seem to be using the output stream. We refer to this as kind of code (in the C++ community) as C with classes. Note this is not a good designation.

As C and C++ are completely different languages with different styles and idioms you should not write a piece of code for one and expect it to be good code in the other language. The fact that the compiler may compile it is just a historical artifact. You should remove one of the tags from question (Since it will not compile as C I suggest you remove the C tag).

Since the question is tagged C++ I will review your code as a C++ program and point out why it is badly designed.

Never do this:

using namespace std;


See: Why is “using namespace std;” considered bad practice?

Useless comments are worse then no comments.

/* C++ Function to print leaders in an array */
void printLeaders(int arr[], int size)


I don't need a comment to tell me this. The name of the function and its parameters are actually very well named. Restrict your comments to a description of why (the code describes how) and well named functions and variables describe what is happening.

C++ code prefers to use iterators it situations like this.

void printLeaders(int arr[], int size)


The problem here is that it is so easy to use this incorrectly. Arrays decay into pointers way to easily. If you use the iterator interface this will prevent this happening accidentally.

template&lt;typename I&gt;
void printLeaders(I begin, I end) {
    // Code
}

// Calling:
int arr[] = {16, 17, 4, 3, 5, 2};
printLeaders(std::begin(arr), std::end(arr));
// If you change the code now and accidentally cause the array to decay into a
// pointer then the compiler will generate a compile time error. The current
// code is way to susceptible to refactoring mistakes.

// Also it allows you to use any container that supports the iterator
// interface (which is all of them including built in array).


You have forgotten to validate your input.  

    int max_from_right =  arr[size-1];


If the size is zero. Then this is undefined behavior.       

I know you are printing here.
But that looks like for de-bugging. 

        if (max_from_right &lt; arr[i])
        {           
            max_from_right = arr[i];
            cout &lt;&lt; max_from_right &lt;&lt; " ";
        }


You could just use std::max() to simplify the code.

You should basically never use the built in array.

    int arr[] = {16, 17, 4, 3, 5, 2};


The container library contains several classes for storing a set of obejcts that are better. std::vector&lt;int&gt; for dynamically sized objects or std::array&lt;int,size&gt; for fixed size containers.

Built in arrays are hard to use correctly. Passing them by reference the syntax is non-trivial. They decay into pointers way to easily. Getting the size of an array is obnoxious as you have to remember to plant the correct division that is easy to mistype (with no compiler checking).

No need to return 0 at the end of main (its special).

    return 0;


Normally in C++ you leave out the return value to indicate that main can never fail. If you explicitly plant return 0 here it is an indication that it succeeds but also a hint there are other return paths that will fail (so I start looking for other return statements in main())