MCA4040- ANALYSIS AND DESIGN OF ALGORITHM

Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601


Assignment

DRIVE
FALL 2014
PROGRAM
MCA
SEMESTER
FOURTH
SUBJECT CODE & NAME
MCA4040- ANALYSIS AND DESIGN OF ALGORITHM
BK ID
B1480
CREDIT & MARKS
4 CREDITS & 60 MARKS

1 Write the steps involved in analyzing the efficiency of non-recursive algorithms.
Answer: Non-recursive algorithms: Non-Recursive functions are partial functions—that is, functions that are not necessarily everywhere defined. In order to emphasize this fact, the term “partial recursive functions” is often used as a synonym. Recursive functions defined for all values of the arguments are called general recursive functions.

Steps in mathematical analysis of non recursive algorithms:
·         Decide on parameter n indicating input size
·         Identify algorithm’s basic operation
·         Determine worst, average, and best case for input of size n
·         Set up summation for C(n) reflecting algorithm’s loop structure
·         Simplify summation using standard f


2 Define selection sort and explain how to implement the selection sort?
Answer: Selection sort is a sorting algorithm, specifically an in-place comparison sort. It has O(n2) time complexity, making it inefficient on large lists, and generally performs worse than the similar insertion sort. Selection sort is noted for its simplicity, and it has performance advantages over more complicated algorithms in certain situations, particularly where auxiliary memory is limited.



3 Define Topological sort. And explain with example.
Answer: A topological sort (sometimes abbreviated topsort or toposort) or topological ordering of a directed graph is a linear ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u comes before v in the ordering. For instance, the vertices of the graph may represent tasks to be performed, and the edges may represent constraints that one task must be performed before another; in this application, a topological ordering is just a valid sequence for the tasks. A topological ordering is possible if and only if the graph has no directed cycles, that is, if it is a directed acyclic graph (DAG). Any DAG has at least one topological ordering, and algorithms are known for constructing a topological ordering of any DAG in linear time.


4 Explain good-suffix and bad-character shift in Boyer-Moore algorithm.

Answer: The algorithm of Boyer and Moore [BM 77] compares the pattern with the text from right to left. If the text symbol that is compared with the rightmost pattern symbol does not occur in the pattern at all, then the pattern can be shifted by m positions behind this text symbol. The following example illustrates this situation.
Example: 
0              1              2              3              4              5              6              7


5 Solve the Knapsack problem using memory functions.
Item 1 2 3 4
Weight 2 6 4 8
Value (in Rs.) 12 16 30 40
Knapsack capacity is given as W=12. Analyze the Knapsack problem using memory functions with the help of the values given above.

Answer: 8q+p+r=0 q+2p+r=0 q+p=1600
" itemprop="textA) 8q + p + r = 0 B) q + 2p + r = 0 C) q + p = 1,600

Considering this is solving for 3 unknowns, the solutions are relatively easy to find.
We solve for each unknown one at a time:
Multiply equation B) by -1 B) -q - 2p - r = 0






6 Describe Variable Length Encoding and Huffman Encoding.

Answer: Variable Length Encoding: A variable-length code is a code which maps source symbols to a variable number of bits.
Variable-length codes can allow sources to be compressed and decompressed with zero error (lossless data compression) and still be read back symbol by symbol. With the right coding strategy an independent and identically-distributed source may be compressed almost arbitrarily close to its entropy. This is in contrast to fixed length coding methods, for which data compression is only possible for large blocks of data, and any compression beyond the
Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601


No comments:

Post a Comment

Note: Only a member of this blog may post a comment.