1. 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
PROGRAM BCA(REVISED FALL 2012)
SEMESTER 2
SUBJECT CODE & NAME BCA2020 -DATA STRUCTURE AND ALGORITHM
CREDIT 4
BK ID B1640
MAX.MARKS 60
Note: Answer all questions. Kindly note that answers for 10 marks questions should be approximately
of 400 words. Each questionis followedbyevaluationscheme.
1 What do you mean by data structure operation? Briefly explain some of the operations used
frequently.
Answer: A data structure is a particular way of storing and organizing data in a computer so that it can
be used efficiently. Different kinds of data structures are suited to different kinds of applications, and
some are highly specialized to specific tasks. For example, B-trees are particularly well-suited for
implementation of databases, while compiler implementations usually use hash tables to look up
identifiers.
Data structures are used in almost every program or software system. Specific data structures are
essential ingredients of many efficient algorithms, and make possible the management of huge amounts
of data,such as large databasesandinternet
2 BrieflyexplainInsertionAlgorithms.
Answer: Insertion sort is a simple sorting algorithm that builds the final sorted array (or list) one item at
a time. It is much less efficient on large lists than more advanced algorithms such as quicksort, heapsort,
or merge sort.However,insertionsortprovidesseveral advantages:
Simple implementation:Bentleyshowsathree-line Cversion,andafive-line optimizedversion.
2. Efficientfor(quite) small datasets
More efficient in practice than most other simple quadratic algorithms such as selection sort or bubble
sort
3 What isqueue?Brieflyexplainarray implementationofqueue.
Answer: A queue is a particular kind of abstract data type or collection in which the entities in the
collection are kept in order and the principal (or only) operations on the collection are the addition of
entities to the rear terminal position, known as enqueue, and removal of entities from the front
terminal position, known as dequeue. This makes the queue a First-In-First-Out (FIFO) data structure.
Queues provide services in computer science, transport, and operations research where various entities
such as data, objects, persons, or events are stored and held to be processed later. In these contexts,
the queue performsthe functionof abuffer.
4 Write a short note on: NP-CompletenessandOptimizationversusdecisionproblems.
Answer: NP-Completeness: NP-completeness is a form of bad news: evidence that many important
problemscan'tbe solvedquickly.
These NP-complete problems really come up all the time. Knowing they're hard lets you stop beating
your headagainsta wall tryingtosolve them, anddo somethingbetter:
Use a heuristic. If you can't quickly solve the problem with a good worst case time, maybe you
can come upwitha methodforsolvinga reasonable fractionof the commoncases.
Solve the problem approximately instead of exactly. A lot of the time it is possible to come up
with a provably fast algorithm, that doesn't solve the problem exactly but comes up with a
solutionyoucanprove is close toright.
5 Write the Algorithm to findthe maximum and minimumitemsin a setof ‘n’ element.
Answer:
1. AlgorithmMaxMin(i,j,max,min)
2. // a[1:n] isa global array Parameteri and j are integers,
3. // 1 „T i „T j < n. The effectisto setmax andminto the
4. // largestand smallestvaluesina[i,j],respectively.
5. {
6. if (i=j) thenmax:=min:=a[i];//small(P)
7. else if (i = j ¡V 1) then//Anothercase of Small (P)
8. {
9. if a [i] < a[j] then
10. {
3. 11. max:=a[j];min:=a[i];
12. }
13. else
14. {
15. max:=a[i];min:=a[j]
6 BrieflyexplainGreedyMethodStrategy.
Answer: The greedy method is a strategy to solve some optimization problems. Let us suppose that we
can solve a problem by a sequence of decisions. The greedy method employs the following approach: In
each stage, our decision is a locally optimal one. For some problem, as we shall see, these locally optimal
solutionswillfinallyadduptoa globallyoptimal solution.
Let us now describe the spirit of greedy method by an example. Consider the case where we are given a
set of n numbers and we are asked to pick out k numbers such that the sum of these k numbers is the
largest,amongall possible waysof pickingoutthese knumbers.
To solve this problem, one may test all possible ways of picking k numbers out of these n numbers. That
is, of course,a foolishwayof solvingthis
Dear students get fully solved assignments
Send your semester & Specialization name to our mail id :
“ help.mbaassignments@gmail.com ”
or
Call us at : 08263069601