jump to navigation

Find Nth Largest number in an Array August 12, 2008

Posted by Thinker in General.

The below is my implementation of finding the nth largest(whichmax)number in the given array of integers.

This would work for both positive and negative integers. This also  affects the given array by manipulating the values of the source array. Hence if you want an non-manipulative algo, this is NOT the one.


#include “stdafx.h”

class Program



int GetNthLargestOptimized(int **intArray,int Length, int whichMax);


int Program::GetNthLargestOptimized(int **intArray,int Length, int whichMax)


int MaxIndex =0;

int MinIndex =0;

bool minFound = false;

for(int nth=0;nth<whichMax;nth++)


for(int index=0;index<Length;index++)


if((*intArray)[MaxIndex]< (*intArray)[index])


                        MaxIndex = index;


if(!minFound && (*intArray)[MinIndex] > (*intArray)[index])


                        MinIndex = index;





                  minFound = true;


if(   nth != whichMax -1)


                  (*intArray)[MaxIndex]= (*intArray)[MinIndex];



return (*intArray)[MaxIndex];


int _tmain(int argc, _TCHAR* argv[])


      Program m;

int intNegativeArray[10]={-1,-2,-3,-4,-5,-6,-7,-8,-9,-10};

int intArray[10]={23,345,345,12,45,23,34,4,6,555};

int *intNegativePtr = intNegativeArray;

      printf(“4th Largest in Negative array:%d\n”,m.GetNthLargestOptimized(&intNegativePtr,10,4));

int *intPtr = intArray;

      printf(“4th Largest in Positive array:%d\n”,m.GetNthLargestOptimized(&intPtr,10,4));

return 0;



Live Writer March 5, 2008

Posted by Thinker in General.
add a comment

I am writing this from the live writer. This is becoming really interesting to blog. The only hitch that i have now is that, the WordPress  themes do not jewel well into the writer. So I am using the Normal view to blog into the wordpress.

This looks very interesting though ūüôā

Hail Mayawati- Let her Live Long. June 8, 2007

Posted by Thinker in General, India, Indian Politics, OBC, Politics, Reservation, Reservation in India, Social Concern.
1 comment so far

I am atlast able to support one leader whom i can trust. I support Mayawati ūüôā Yes she is a dalit leader, so is she a leader for Brahmins.

Dravidian moments always portay that a miniscule 2% Brahmin community was the reason for all their suppresion. If you really see its the OBCs that actually supress the Dalits and at the same time supress the  Brahmins as well.

The OBCs (take an example of Thevars who always kill and ruin dalits live near their towns in Tamil Nadu), discriminate the Dalits in their acts and while talking politically present themselves to be supporter of Dalits.

Ask an OBC what they have done for the upliftment of the Dalits for the last 60years, when actually they were the rulers of Tamil Nadu.¬† Why is the dalit’s condition not improved with the governance of Dravidian parties!

It is simple, OBCs are the exploiters and offenders of the Dalits. But they happily put the blame on the brahmins. Its easy to play a blame game;Its more easier to blame a silent,soft ommunity that doesnt have any political backup what so ever. What people say, beating a dead man and claiming victory.

Take an example of the Tamil Nadu government and tell me the total amount of Brahmin MLAs in the assembly, its just two, one is Jayalalitha and the other is ¬†SV Sekhar. The remaining lot is the OBcs who are still working for last 60 years to bring the dalit’s life to a better one. But all these 60¬†¬†years of their rule, have you ever seen the dravidian parties¬† did¬† anything good to dalits? All they did is to offend Brahmins and their disciplined life.¬†All they did in 60years is to systematically offend Brahmin community(hitting a dead man)¬†and neglecting¬† improvement of the actual underpriveledged.

If they have done any good to dalits, why is dalit’s conditions have not improved in last 60years, dont tell me two brahmin MLAs were the whole reason for their non-improvement!!

This is the reality, its the ruling class(OBCs) who are the exploiters of every other castes. They were the exploiters of Dalits and Brahmins.

It has just started that the two opressed communities (dalits and Brahmins) are just joining their hands together. Let us march forward and get our self respect back from the ruling OBCs.

Been away from Blogging December 8, 2006

Posted by Thinker in General.
1 comment so far

I have been bit busy personally and officially for last several months to be away from blogging..

Atleast now i feel i should devote some time  back to blogging.

In Chennai this week end. August 11, 2006

Posted by Thinker in General, India.

I would be in Chennai this week end. So expect a post after 17th. Till then i would most probably not post:)

You are looking at an Featured Blog by WordPress. August 6, 2006

Posted by Thinker in General, Reservation in India.
add a comment

Yes, my blog is a featured blog under “Reservation in India” category.¬† Visit :http://wordpress.com/tag/reservation-in-india/ this link…

Lets improve the education of Backward Classes May 30, 2006

Posted by Thinker in General.

The trick has payed off.. These dirty guys of politicts wanted to divide us in the name of caste.. and what an irony.. We now stand divided. The divion of OBCs and Forward caste.. is becoming more relevant now. At this point, i thought, let me not just take part in agitation against reservation, Reservation is the whole point to get the society divided on the basis of caste and creed and to garner votes!

I am planning to do social service to visit villages near to my current residance and help poor students get some good education. I feel the need of the hour is not Reservation, the need of the hour is social service!

We need to improve the conditions of the poor people of India, they may be from back ward caste, they may be from forward caste, i dont care. We need to help them get good education.

I want India to be a great place to live, i want humanity to spread love and affection towards all.

I carve for unity , I carve for a united India, I carve for a political setup that works only for the harmony of the people. I hate this dive and rule policy of Reservation.

I feel the best way to improve the economically backward class (I hate to call some people as backward class just because they were born in a specified caste!), is to set up good educational institutes near to their home and give them quality free education that facilitates them to take on the best of the breed!

This is definelty possible with a honest commitment from the governement and if followed religiously without any discrimination on caste ,creed, religion or region, it is a way to a successful india.

The alternative to reservation is to provide education to all and make all classes competent and competitive. Let us help the poor class to get good education. This is a postive approach to the problem.

I am against any split in India on the name of Caste , Creed, Religion or Region!

Lets do good to fellow human beings.. let us spread the message of Love.

Jai hind

South India – A lesson to be learnt for the forward community. May 29, 2006

Posted by Thinker in General.

Some excerpts from NTDV.com URL: http://www.ndtv.com/template/template.asp?fromtimeline=true&id=88471&callid=1&template=Reservation

“Brahmins of Tamil Nadu are like the Jews of Germany. They are not being physically liquidated but they are being suffocated and squeezed educationally,” said former UN information consultant SR Madhu.

“Tamil Nadu’s quota, which stands at 69 percent has effectively driven the forward community out of the state.” – NDTV.

So guys if you dont come to the street and protest against this discrimination that is being carried out, North India would also end up like the south.

We need to analyse how the Tamil Nadu goverments (Dravidian parties) were able to effectively rout most of the Brahmin community out of Tamil Nadu and how we can help them get back there. Without our support they can never survive. And If we take this lightly, the same scenario might spread across the whole of India which is very much a worrying factor.

Subash Chandra Bose – Why Britishers left India? May 28, 2006

Posted by Thinker in General.

Some exerpts from a grandson of an INA Army person: Courtesy Rediff.com (see the link above).
In post-Independent India the INA’s role was played down. The official evaluation was that its activities had little effect. Militarily speaking that was true because the army was not that well equipped, but the British made a great political mistake by putting three INA officers on trial at the Red Fort (in Delhi), expecting that people would look down on them as traitors. The opposite happened and the trial publicized the efforts of the INA, which had previously been censored.
Until the trial little had been known of the INA or the Government of India in exile in 1943 when they tried to send food to Bengal during the Great Famine. All of a sudden this trial made everything known and it revived the struggle for independence in India, which had been lagging because the leadership of the Congress party and other groups mostly had been imprisoned. Their efforts like the Quit India movement had not been successful and so this gave a new dawn to the movement.
As a consequence of the INA’s efforts, large numbers within the British Indian Army — which was not just British but for the most part Indian — became unreliable. There was a mutiny in Bombay (by the Royal Indian Navy), which showed the armed forces could not be depended on. The administrative system was what had controlled India and with the army unreliable the British realised India could not be held as a colony any more. This led to the transfer of power. It was meant to have taken place a few months later, but it was brought forward to August 1947.
You could therefore say the INA had this effect of destabilising the British hold on the Indian army and reviving the independence movement within India.
The INA certainly has its place in Indian history.
When the first few INA soldiers returned to India they were treated as heroes, but I must say in the later stages India has not treated them very well. The INA veterans were not recognised as army veterans and for a very long time they were not even recognised as freedom fighters, which meant that certain benefits such as a pension and free rail travel were denied to them. Many members of the INA were reduced to poverty and some of them died in hunger. These were simple people and could not find their way that easily in the country to which they returned.
India has not behaved towards this group in an honorable or fair way.

Politics of Reservation And Future of India – A Public address in Hyderabad May 27, 2006

Posted by Thinker in General.
1 comment so far


I attended a public meeting today organized by “Social cause”- a social organization and jointly co-hosted by Youth for Equality Hyderabad chapter. It was a great experience that many people have similar feelings. One astounding fact is the enthuthiasm showed by all the people over there. All of the guys had fire in their belly and were highly lit up. Every one were very highly patriotic – how do I know.. when we completed this meeting, national anthem was sung by the madam in the Dias.. but as she started singing the national anthem, the whole crowd joined her in the singing.. It was very nice that there were so many patriotic guys still around. I could see their proud faces as they sang the national anthem.

Its me in the navy blue shirt giving a momento to one of the speakers.

Mr.Hanumanth Rao giving his speech.