/algorithm

Primary LanguageJava

Fibonanic & Sort & Matrix Application

Steps to Setup

  1. Right-click ‘dot.java’ class and select Run As->Java Application

  2. Output will be displayed in the Eclipse IDE->Console

Test development example

1. Factorials

For an input N = 25, output will be 15511210043330985984000000.

2. Sorting

Given an array with n elements, sort this array in ascending order using only one of the following operations.

Sample Input #1

2

4 2

Sample Output #1

yes
swap 1 2

Sample Input #2

3 3 1 2

Sample Output #2

no

Sample Input #3

6

1 5 4 3 2 6

Sample Output #3

yes reverse 2 5

3. Matrix Rotation

Sample Input #00

4 4 1

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Sample Output #00

2 3 4 8

1 7 11 12

5 6 10 16

9 13 14 15

Sample Input #01

4 4 2

1 2 3 4

5 6 7 8

9 10 11 12

13 14 15 16

Sample Output #01

3 4 8 12

2 11 10 16

1 7 6 15

5 9 13 14

Sample Input #02

5 4 7

1 2 3 4

7 8 9 10

13 14 15 16

19 20 21 22

25 26 27 28

Sample Output #02

28 27 26 25

22 9 15 19

16 8 21 13

10 14 20 7

4 3 2 1

Sample Input #03

2 2 3

1 1

1 1

Sample Output #03

1 1

1 1