## Bitonic Sequence

A bitonic sequence is a sequence of numbers that first monotonically increases and then monotonically decreases. In other words, it is a sequence that has a single peak. For example, the sequence 1, 3, 4, 5, 6, 7, 4, 2 is a bitonic sequence because it first increases from 1 to 7, and then decreases from 7 to 2.

## Merging Network

A merging network is a network of comparators that is used to sort a sequence of numbers in ascending or descending order. A comparator is a device that takes two inputs and produces two outputs, such that the outputs are the inputs in either ascending or descending order.

A merging network can be used to sort a bitonic sequence in O(log^2 n) time, where n is the length of the sequence. The algorithm for sorting a bitonic sequence using a merging network is as follows:

- Divide the sequence into two bitonic sub-sequences.
- Sort each sub-sequence recursively using the same algorithm.
- Merge the two sorted sub-sequences using a merging network.

To merge two sorted bitonic sequences using a merging network, we first compare the elements at the top of each sequence using a comparator. If the first element is smaller, we swap the two elements. We then recursively merge the two sub-sequences formed by splitting each sequence at the point where the swapped element was located.

The merging network can be implemented using a binary tree structure, where each node represents a comparator. The input sequence is fed into the leaves of the tree, and the output sequence is read from the root of the tree. The merging network can also be implemented using a matrix of comparators, where the rows and columns represent the inputs and outputs of the comparators, respectively.

## Summary

Bitonic sequence is a sequence of numbers that first monotonically increases and then monotonically decreases, and a merging network is a network of comparators that is used to sort a sequence of numbers. A merging network can be used to sort a bitonic sequence in O(log^2 n) time, and can be implemented using a binary tree structure or a matrix of comparators.

- Q-1.
- What do you understand by time and space complexity? What is asymptotic notation? Why it is important? Discuss using suitable example.
- Q-2.
- What is recurrence? Discuss in detail the master method for solving a recurrence.
- Q-3
- What is a Travelling Salesman problem? Discuss the greedy algorithm for solving the Travelling Salesman Problem.
- Q-4
- What do you understand by height balanced tree? What is a splay tree? Discuss the insertion/deletion operation on splay tree.
- Q-5
- What is Minimum Spanning Tree? Discuss the Steps for finding Minimum Spanning Tree using Kruskal’s Algorithm.
- Q-6
- What is a Graph? Discuss the depth first traversal of a graph and its computational complexity. Also discuss the topological sort using depth first traversal.
- Q-7
- What is a flow network? Explain Ford-Fulkerson Algorithm for Maximum Flow Problem.
- Q-8
- What is bitonic sequence? What is merging network? Explain.