Thread: solve

  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    1

    solve

    An array given Arr[] which is in decreasing order. How many swapping required in
    for(int index=0;index
    {
    for(int j=n-index;j
    {
    if(a[j]>a[j+1])
    {
    swap(a[j],a[j+1]);
    }
    }
    }

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Welcome to the forum rahulietlko!

    <puts on my Drill Instructor hat>

    "Do I look like a computer, to you?"

    "On this planet, we expect the computer programs to do the mundane counting, for us, not the other way around"

    "Now get back to that program, add a counter variable, and let the program do the counting!

    "The raw recruits we get here at the Marine Depot Training Center - you would not believe."

    P.S. And use code tags around your program, next time, by clicking on the # icon, inside the advanced reply window. Right at the top, just right of top dead center.

    <Returns D.I. hat to place of honor>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to solve this question?
    By zcrself in forum C Programming
    Replies: 9
    Last Post: 03-10-2010, 12:12 AM
  2. Help to solve My easy C programing questions!
    By hotwebs in forum C Programming
    Replies: 13
    Last Post: 12-25-2009, 03:55 AM
  3. Replies: 2
    Last Post: 04-25-2005, 11:59 AM
  4. ^^ help me solve the error
    By skwei81 in forum C++ Programming
    Replies: 2
    Last Post: 04-03-2003, 09:04 AM
  5. Help to solve this problem
    By Romashka in forum C++ Programming
    Replies: 3
    Last Post: 04-16-2002, 09:32 AM