Array is a container which can hold a fix number of items and these items should be of the same type. Most of the data structures make use of arrays to implement their algorithms. Following are the important terms to understand the concept of array.
Separation of Lanthanides/ Lanthanides and Actinides
Â
data structure and algorithms Unit 5
1. * Back tracking : The General Method
* The 8-Queens Problem
*Sum Of Subsets
* Graph Coloring
2. ď‚— Backtracking represents one of the most general
techniques. Many problems which deal with searching
for a set solutions or which ask for an optimal solution
satisfying some constraints can be solved using
backtracking formulation.
ď‚— In many applications of the backtrack method the
desired solution is expressible as an n-tuple
(x1,……,xn), Where the xi are chosen from some finite
set Si.
3. ď‚— For example , Consider the sudoko solving problem, We
try filling digits one by one. Whenever we find that current
digit cannot lead to a solution, We remove it (backtrack)
ď‚— And try next digit. This is better than naĂŻve approach (
generating all possible combination of digits and the trying
every combination one by one) as it drops a set of
permutations whenever it backtracks.
4. ď‚— The 8-queens problem via a backtracking solution. In
fact we trivially generalize the problem and consider
an n*n chess board and try to find all ways to place n
nonattacking queens.
ď‚— Imagine the chessboard squares being numbered as
the indices of the two-dimensional array a[1:n,1:n],
then we observe that every element on the same
diagonal that runs from the upper left to the lower
right has the same row-column value.
5.  i – j = k – l (or) i + j = k – l
ď‚— The first equation implies
 j – l = i – k
ď‚— The second equation implies
 j – l = k – i
6. ď‚— Sum of subsets problem is to find subset of elements
that are selected from a given set whose sum adds up
to a given number k. We are considering the set
contains non-negative values. It is assumed that the
input set is unique (no duplicates are presented ).
ď‚— One way to find subsets that sum to K is to consider all
possible subsets. A Power set contains all those
subsets.
7.  Assume given set of 4 elements, say W[1]….W[4]. Tree
diagrams can be used to design backtracking algorithms .
The following tree diagram depicts approach of
generating variable sized tuple.
8. ď‚— Let G be a graph and m be a given positive integer. We
want to discover whether the nodes of G can be
colored in such a way that no two adjacent nodes have
the same color yet only m colors are used. This is
termed the m – colorability decision problem. The d
is the degree of the given graph, then it can be colored
with d+1 colors. The m-colorability optimization
problems asks for the smallest integer m for which the
graph G can be colored.
9. ď‚— This integer is referred to as the chromatic number of
the graph. For example, the graph can be colored with
three colors 1,2, and3 . The color of each node is indicated
next to it. It can also be seen that three colors are needed
to color this graph and hence this graph’s chromatic
number 3.