answersLogoWhite

0


Best Answer

step 1: Analyse the radix sort procedure first.

step 2:Convert the procedure in to the c coding

#include<stdio.h>

#define MAX 5

#define SHOWPASS

void print(int *a,int n)

{

int i;

for(i=0;i

printf("%d\t",a[i]);

}

void radixsort(int *a,int n)

{

int i,b[MAX],m=0,exp=1;

int bucket[10]={0};

for(i=0;i

{

if(a[i]>m)

m=a[i];

}

while(m/exp>0)

{

for(i=0;i

bucket[a[i]/exp%10]++;

for(i=1;i<10;i++)

bucket[i]+=bucket[i-1];

for(i=n-1;i>=0;i--)

b[--bucket[a[i]/exp%10]]=a[i];

for(i=0;i

a[i]=b[i];

exp*=10;

#ifdef SHOWPASS

printf("\nPASS : ");

print(a,n);

#endif

}

}

int main()

{

int arr[MAX];

int i,n;

printf("Enter total elements (n < %d) : ",MAX);

scanf("%d",&n);

printf("Enter %d Elements : ",n);

for(i=0;i

scanf("%d",&arr[i]);

printf("\nARRAY : ");

print(&arr[0],n);

radixsort(&arr[0],n);

printf("\nSORTED : ");

print(&arr[0],n);

printf("\n");

return 0;

}

You can see the the same program with output in related links, below.

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

15y ago

These are basically the instructions written in plain English to solve any problem. It makes a layman understand the complexity of the problem. Pseudo is a way of describing and algorithm without using any specific programming language. It can be the example of real life examples, but it cannot be implemented in computer. It is written roughly at same level of detail.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the pseudo code of radix sort in C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

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"}


What is pseudo code in c?

Writing in pseudo code means writing in a natural language, not in any specific programming language, so there is no thing as "pseudo-code used in C" as opposed to "pseudo-code used in Java".When you write in pseudo-code, you don't have to follow any specific syntactic rules, just to describe the steps you will use in your algorithm.For example, pseudo-code for bubble sort (taken from wikipedia):procedure bubbleSort( A : list of sortable items ) do swapped = false for each i in 1 tolength(A) - 1 inclusive do: if A[i-1] > A[i] then swap( A[i-1], A[i] ) swapped = true end ifend for while swapped end procedureIt is not written in any programming language, but it should be easy to implement this in any language after you understand the idea from the pseudo-code.


How do you get Pseudo code for largest element of an array?

Pseudocode: if x &gt; y then return x else return y Actual code (C++): return( x&gt;y ? x : y );


Would you identify a problem in mechanical engineering and develop a program to solve it by drawing a flowchart writing a pseudo code that satisfies the flowchart and write the c code for the program?

I really don't understand you.....


Different types of sorting techniques in c language?

types of sorting in c language are: insertion sort selection sort bubble sort merge sort two way merge sort heap sort quick sort

Related questions

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"}


What is pseudo code in c?

Writing in pseudo code means writing in a natural language, not in any specific programming language, so there is no thing as "pseudo-code used in C" as opposed to "pseudo-code used in Java".When you write in pseudo-code, you don't have to follow any specific syntactic rules, just to describe the steps you will use in your algorithm.For example, pseudo-code for bubble sort (taken from wikipedia):procedure bubbleSort( A : list of sortable items ) do swapped = false for each i in 1 tolength(A) - 1 inclusive do: if A[i-1] > A[i] then swap( A[i-1], A[i] ) swapped = true end ifend for while swapped end procedureIt is not written in any programming language, but it should be easy to implement this in any language after you understand the idea from the pseudo-code.


How can i write pseudo code for C plus plus if i haven't even wrote the program yet?

You are going about this backwards. First, define the program. Second, describe its algorithm. Third, if needed, write pseudo code. (Sometime, algorithm and pseudo code is the same process.) Fourth, or third, write real code.


Is pseudo code is a) high level language b) assembly language c) machine language?

in RST interrupt , RST STAND FOR


What bank has sort code 62-31-31?

eccount c


What has the author J C Radix written?

J. C. Radix has written: 'La Navigation par inertie' -- subject(s): Inertial navigation, Inertial navigation systems 'Localisation inertielle ..' -- subject(s): Inertial navigation systems


How do you get Pseudo code for largest element of an array?

Pseudocode: if x &gt; y then return x else return y Actual code (C++): return( x&gt;y ? x : y );


Would you identify a problem in mechanical engineering and develop a program to solve it by drawing a flowchart writing a pseudo code that satisfies the flowchart and write the c code for the program?

I really don't understand you.....


What is the function of pseudo code?

Pseudo code is a way of communicating the structure of an algorithm or program without worrying about particular details of the implementation. Good pseudo code gives the reader all the information he or she needs to actually implement the algorithm, while saving the writer from dealing with any weird particularities of any one language. For example: Lets write a function which search a list for a value in pseudo code: recursiveSearch(List l, Value v): for each value in l: if value v){ return l[i]; } } } Hopefully its clear that the pseudo code version is easier to parse while reading (except maybe for some C gurus out there) and can be easily translated into any programming language, while the second is more obscure.


Tell me the pseudo code for converting Fahrenheit to Celsius?

Subtract 32 from the temperature in Fahrenheit. Multiply the result with 5/9.C = (F-32) * 5 / 9


What is the branch address of sort code 08-60-64?

The sort code 08-60-64 relates to the address: Savings Gosforth (C/A), Principal Office, Northern Rock House, Newcastle Upon Tyne, NE3 4PL


What branch has sort code 72-50-06?

It's a Yorkshire Bank s/c. Where, I don't know (check their website)