## Data Structures and Algorithms | Set 3

Following questions have asked in GATE CS exam. 1. Suppose you are given an array s[1…n] and a procedure reverse (s,i,j) which reverses the order… Read More »

## Block swap algorithm for array rotation

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

## Python Program for Reversal algorithm for array rotation

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example : Input : arr[] = [1, 2, 3, 4,… Read More »

## Java Program for Reversal algorithm for array rotation

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example : Input : arr[] = [1, 2, 3, 4,… Read More »

## C Program for Reversal algorithm for array rotation

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example: Input: arr[] = [1, 2, 3, 4, 5, 6,… Read More »

## Reversal algorithm for array rotation

Write a function rotate(arr[], d, n) that rotates arr[] of size n by d elements. Example : Input : arr[] = [1, 2, 3, 4,… Read More »

## Python Program for array rotation

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

## Java Program for Program for array rotation

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

## C Program for Program for array rotation

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

## Program for array rotation

Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. Rotation of the above array by 2 will make array… Read More »

## Program to count leaf nodes in a binary tree

A node is a leaf node if both left and right child nodes of it are NULL. Here is an algorithm to get the leaf… Read More »

## Level Order Tree Traversal

Level order traversal of a tree is breadth first traversal for the tree. Level order traversal of the above tree is 1 2 3 4… Read More »

## Compute the minimum or maximum of two integers without branching

On some rare machines where branching is expensive, the below obvious approach to find minimum can be slow as it uses branching. filter_none edit close… Read More »

## Rotate bits of a number

Bit Rotation: A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put… Read More »

## Write a program to reverse an array or string

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