answersLogoWhite

0

/* Bubble sort:

code snippet only

nos to be sorted are in the array named 'n' of size 'N'

for(int i=0;i<N-1;i++)

for(int j=i+1;j<N-1-i;j++)

if(n[j]>n[j+1])

swap(n[j],n[j+1]);

*/

/*

insertion sort

int v,j;

for(int i=1;i<N;i++)

{

v=n[j];

for(int j=i-1;j>0&&n[j]>v;j--)

n[j+1]=n[j];

n[j+1]=v;

}

*/

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

How do you write a C plus plus program that will display the first 10 positive prime numbers?

By learning how to program on C+.


A program c plus plus on automorphic numbers or not?

how to write a program that counts automorphic number from 1 to 999


C program to print numbers 1 to n?

how do we use loops in c plus plus programing and what are basic differences between do,for and while loop


How do you write a c plus plus program to sort a vector of strings using MSD radix sort?

The standard library sort algorithm automatically uses MSD radix to sort strings: std::vector&lt;std::string&gt; vs = {"a", "b", "c" "d", "ab"}; std::sort(vs.begin(), vs.end()); After sorting, the order will be: {"a", "ab", "b", "c", "d"}


Can you program games with c plus plus?

Yes, you can program games with C++.


What is the sort cut for running c plus plus program?

It depends on the particular IDE. Visual Studio uses &lt;Ctrl&gt;F5 to start a program in non-debug mode, and F5 to start a program in debug mode.


Write a c plus plus program to find the largest among three numbers using ternary operators?

R = (A &gt; B &amp;&amp; A &gt; C) ? A : (B &gt; C) ? B : C; // parentheses not necessary - for clarity only


C plus plus program calculate the power value of input base and exponent numbers?

cn = c0 *( 1 + i ) pow n


How to restart c plus plus program?

Exit the program and relaunch it.


Create a c plus plus program that displays odd numbers between 15 and 30?

for (int i = 15; i &lt; 30; i += 2) cout &lt;&lt; i &lt;&lt; endl;


Lint is a compiler b a interactive debugger c a cinterpreter d a tool for analysing c plus plus program?

d a tool for analysing c plus plus program


Types of sort in c plus plus?

There's only one type of sort in C++; std::sort. If you want other types you'll need to write your own.

Trending Questions
Is there types of electrodes in Shielded Metal Arc Welding? What restrictions apply to the values that can be assigned to subscripts? What is the unit weight of concrete in s i units? How can you use pressure in a sentence? The A-10 fuselage components that redistribute loads around cutouts and provide redundant load paths are? Is rubbish a renewable energy source? What is the relation between density and compressive strength of concrete? The potential difference across a circuit is given by the complex number V equals 5 plus j12 volts and the current is given by the complex number you equals 921degrees amperes - calculate the angle be? Why is water as a good conductor of electricity cannot be used as a cable? What Brass is used for pneumatic fittings? Can an exception be re-thrown? How fast should you have to pump a cornish pump organ to maintain proper air flow to the reeds? Can you give 230V ac directly to bridge rectifier? Were did the term robot come from? How do you Write a pseudo code to reset every pixel in an image that is in the 24-bit 256 entry look-up table representation to its complementary color? What does the sum of the digit mean? How can override the precedence define by c language? Is a piano a simple or compound machine? Create a class rectangle The class has attributes length and width each of which is defaults to 1 It has member functions that calculates the perimeter and the area of the rectangle it has set? What are the differences between the mass concrete and reinforced concrete?