answersLogoWhite

0

You can sort an array with any method you want, but there is a built-in qsort function, declared in stdlib.h (see the attached link).

bubble sort, quick sort, insertion sort, merge sort, radix sort and lot more..

merge sort is the most efficient one..

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Engineering

What object is used to store a set of values in a single variable name?

In the simplest case, that would be an array. However, many programming languages also have other types of collections - single objects which, in turn, can contain several other objects.


In C programming a character variable can at a time store how many characters?

You can store one, however if you make a char array: char[50]; You can make a string out of your array of characters.


In Computer programming Why is it considered good programming practice to define the number of array items as a constant before declaring the array?

In computer programming, (1) When a number is needed several times in a program, it is good practice to give that number a name. (2) When a name refers to a number that will never change during a run of a program, it is good practice to declare it as a constant before using it. In most programming languages, we do not define the number of array items as a constant. In many programming languages, it is easy to add items to an array, and an array keeps track of the number of items it holds, which a program can access using something like "array.length" or "array.shape". However, in C and C++ programming, the programmer must define the size of the array at the time it is defined, and the array does not keep track of the number of items it contains. To not define your array would leave the program open to unchecked growth. "Capping" the array with an upper value ensures that, if something goes wrong, you will not crash the application or system. Also, capping the array will make debugging potentially easier. Capping requires using that number in several places, and so (1) tells us it is good practice to give that number a name. Since it is not possible(*) to change the size of an array in C or C++, the number that holds the number of items in the array will never change, and so (2) tells us it is good practice to declare it as a constant. (*) There are a few tricks one can do with malloc() and realloc() that have the same effect as resizing an array, although technically all those tricks merely create a new fixed-size array.


What types of data used in algorithm?

Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.


How do you sort an array of numbers?

Use a sorting algorithm. There are a bewildering number of sorting algorithms, both stable and unstable. To sort numbers, an unstable sort suffices. The algorithm you use will depend on how many numbers need to be sorted (a small or a large set), however a hybrid algorithm (a combination of two or more algorithms) can cater for both. Introsort (unstable) and timsort (stable) are the two most common hybrid sorting algorithms.

Related Questions

How many Types of sorting algorithm?

ten types of soting algorithm


What object is used to store a set of values in a single variable name?

In the simplest case, that would be an array. However, many programming languages also have other types of collections - single objects which, in turn, can contain several other objects.


Which is the best website for practicing programming?

w3schools has many tutorials for many different types of web programming language. breakinterview.com has some good questions for practice .


In C programming a character variable can at a time store how many characters?

You can store one, however if you make a char array: char[50]; You can make a string out of your array of characters.


How do you Find the highest (maximum) and lowest (minimum) grades in an array?

You can get many example of"c programming" Reference:cprogramming-bd.com/c_page1.aspx# integer grades


In Computer programming Why is it considered good programming practice to define the number of array items as a constant before declaring the array?

In computer programming, (1) When a number is needed several times in a program, it is good practice to give that number a name. (2) When a name refers to a number that will never change during a run of a program, it is good practice to declare it as a constant before using it. In most programming languages, we do not define the number of array items as a constant. In many programming languages, it is easy to add items to an array, and an array keeps track of the number of items it holds, which a program can access using something like "array.length" or "array.shape". However, in C and C++ programming, the programmer must define the size of the array at the time it is defined, and the array does not keep track of the number of items it contains. To not define your array would leave the program open to unchecked growth. "Capping" the array with an upper value ensures that, if something goes wrong, you will not crash the application or system. Also, capping the array will make debugging potentially easier. Capping requires using that number in several places, and so (1) tells us it is good practice to give that number a name. Since it is not possible(*) to change the size of an array in C or C++, the number that holds the number of items in the array will never change, and so (2) tells us it is good practice to declare it as a constant. (*) There are a few tricks one can do with malloc() and realloc() that have the same effect as resizing an array, although technically all those tricks merely create a new fixed-size array.


What types of data used in algorithm?

Whatever data you need. If you need the algorithm to operate with many different types of data, and you are programming in C++, you could use generic programming practices and use templates.


Give the syntax to declare two dimensional array using array of pointers?

It is not possible to declare a two-dimensional array using an array of pointers in any programming language, but many programming languages support declarations of N-dimensional arrays of pointers.The exact syntax varies with the programming language, and requires support for N-dimensional arrays and pointers. In C, the following declares an array of pointer variables, each implemented as pointer to the generic type "void":void* array_1D[10];The type of the expression array_1D is "void * const."The following example expands on the previous one by declaring a two-dimensional array of "void" pointers:void* array_2D[10][20];The type of the expression array_2D is "void ** const."The last example declares a 3-dimensional array of "void" pointers, which can be seen as a 2-dimensional array of arrays of pointers:void* array_3D[10][20][30];


How do you sort an array of numbers?

Use a sorting algorithm. There are a bewildering number of sorting algorithms, both stable and unstable. To sort numbers, an unstable sort suffices. The algorithm you use will depend on how many numbers need to be sorted (a small or a large set), however a hybrid algorithm (a combination of two or more algorithms) can cater for both. Introsort (unstable) and timsort (stable) are the two most common hybrid sorting algorithms.


What are big big box stores?

stores that sell many types of items


How many data types can the elements of an array have?

Depends on your language. Assuming java: If you make it an Object[] then it can contain any object For primitive types you must either make a primitive type array, ie double[], char[] which can contain only those primitives, or creater an Object[] and use primitive wrapper objects ie java.lang.Integer etc.


What is an arrey and how many types of arrey in details?

An array is a data type that describes a collection of ordered variables and types of arrays include vector arrays and matrix arrays.