Given two positive numbers x and y, check if y is a power of x or not.
Examples :
Input: x = 10, y = 1
Output: True
x^0 = 1
Input: x = 10, y = 1000
Output: True
x^...

Share

Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s and all 2s in last.
Examples:
Input :...

Share

Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many di...

Share

Heap sort is a comparison based sorting technique based on Binary Heap data structure. It is similar to selection sort where we first find the maximum element and pl...

Share

Given an array and a number k where k is smaller than size of array, we need to find the k’th smallest element in the given array. It is given that ll array ...

Share

Given an array (or string), the task is to reverse the array/string.
Examples :
Input : arr[] = {1, 2, 3}
Output : arr[] = {3, 2, 1}
Input : arr[] = {4, 5, 1, 2}
...

Share

Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers which has the largest sum.
...

Share

Given an array of integers where each element represents the max number of steps that can be made forward from that element. Write a function to return the minimum n...

Share

Given an array A[] consisting 0s, 1s and 2s, write a function that sorts A[]. The functions should put all 0s first, then all 1s and all 2s in last.
Examples:
Input :...

Share

Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices such that for every directed edge uv, vertex u comes before v in the ordering....

Share