# Array

Given an Array of (say) integers like below: 1 2 3 4 5 6 7 8 and an index, say, 2. Write a function which will rotate the array around index 2. i.e the output should be: 3 4 5 6 7 8 1 2

Print all possible permutations of an Array or a String. For Example: If the array is arr={1, 2, 3}. Then the possible permutations are: 1 2 3 1 3 2 2 1 3 2 3 1 3 1 2 3 2 1

Given a Matrix of positive integers and 2 cells A & B. You have to reach from A to B covering cells such that the sum of elements in path is minimum. You can travel in forward, downward and diagonally. For example: If the given Matrix is as below: 1 2 3 4 8 2 […]

Given an array which has only 0’s and 1’s. Write an algorithm which will sort this array. (i.e separate 0’s and 1’s by bringing 0’s before 1’s). Input Array: {0, 1, 1, 0, 0, 0, 0, 1, 1, 0} Output Array: {0, 0, 0, 0, 0, 0, 1, 1, 1, 1}

Given an array of m elements and an integer k ( total size of array >= m+k), . Write code to shift all the elements of array forward by k positions. For example: If k = 2 and the Input array is as given below, the the output array should be: The extra spaces will […]