Convert max heap to min heap in linear time
Given an array representing a max-heap, in-place convert it into the min-heap in linear time.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an array representing a max-heap, in-place convert it into the min-heap in linear time.
Write a program to determine if a given string is palindrome or not. A palindromic string is a string that remains the same with its characters reversed.
Given a set of activities, along with the starting and finishing time of each activity, find the maximum number of activities performed by a single person assuming that a person can only work on a single activity at a time.
Given a set of vertices V in a weighted graph where its edge weights w(u, v) can be negative, find the shortest path weights d(s, v) from every source s for all vertices v present in the graph. If the graph contains a negative-weight cycle, report it.
Given a directed graph, check if it is strongly connected or not. A directed graph is said to be strongly connected if every vertex is reachable from every other vertex.
The transitive closure for a digraph G is a digraph Gā with an edge (i, j) corresponding to each directed path from i to j in G. The resultant digraph Gā representation in the form of the adjacency matrix is called the connectivity matrix.
The arrival time is the time at which the vertex was explored for the first time in the DFS, and departure time is the time at which we have explored all the neighbors of the vertex, and we are ready to backtrack.
Write a recursive program to efficiently reverse a given string in C, C++, and Java.
Write an iterative program to reverse a string in C++ and Java.
Write a recursive C/C++, Java, and Python program to calculate the factorial of a given positive number.
Write a recursive program to find all factorial numbers less than or equal to n. The factorial n! of a non-negative integer n is the product of all positive integers less than or equal to n.
Write an iterative C/C++ and java program to find factorial of a given positive number.