find the next largest permutation in lexicographic order aft

find the next largest permutation in lexicographic order after each of the following permitation

a 1432

b 54123

c 6715432

Solution

a) number is 1432

the digit at one\'s place is 2

the digit ay ten\'s place is 3

it is bigger than the previous digit that is 2

thus list is (2,3)

the digit at hundred place is 4

it is greater than previous digit that is 3

then list is (2,3,4)

the digit at thousand place 1 which is smaller than its previous digit 4

then the smaller number greater than 1 is 2

swap two numbers

then list of number is 2134

b)

54123

the digit in ones place is 3

the digit in tens place is 2

listis (2,3)

the digit at hundreds place is 1

which is smaller than previous digit that is 2

swap 1 and 2

list is (2,1,3)

thus number is 54213

c)

6715432

at one place the digit is 2

at tens place number is 3 which is greater than2 the list is (2,3)

the digit at hundred place is 4 which is greater than previous number 3

thus list is (2,3,4)

5 is greter than previous number 4

thus list of nmber is (2,3,4,5)

the digit at ten thousand place is 1

which is smaller than previous number 5

swap 1 with smallest bignumber of 1 that is 2

then list is (2,1,3,4,5)

swap 6,7

then number is 7621345

find the next largest permutation in lexicographic order after each of the following permitation a 1432 b 54123 c 6715432Solutiona) number is 1432 the digit at
find the next largest permutation in lexicographic order after each of the following permitation a 1432 b 54123 c 6715432Solutiona) number is 1432 the digit at

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site