Winter 2014 SOE PROGRAM BCA(REVISED FALL 2012

PROGRAM
SEMESTER
SUBJECT CODE & NAME
BK ID
CREDIT
MAXIMUM MARKS
Q.
No
1
A
2
Winter 2014 SOE
BCA(REVISED FALL 2012)
2
BCA2020 -DATA STRUCTURE AND ALGORITHM
B1640
4
60
Question and Scheme of Evaluation
What do you mean by data structure operation? Briefly explain
some of the operations used frequently.
Operations are used to process the data appearing in the data
structure
The following are the some of the operations used frequently.

Traversing: Accessing each record exactly once so that
certain items in the record may be processed.

Searching: Finding the location of the record with the given
key value.

Inserting: Adding a new record.

Deleting: Removing a record.

Sorting: Arranging the records in some logical order.

Merging: Combining the records in two different file into a
single file.
Briefly explain Insertion Algorithms.
Unit/
Page
No.
U1/7
Marks
Total
Marks
4+6
10
U2/18
10
10
A
Algorithms for inserting an ITEM into linked list
The first one is inserting a node at the beginning of a list and the
second one is inserting after the node with a given location. An
ITEM contains the new data to be added to the list…..
All insertion algorithms, use a new node from AVAIL list, the
following are the steps which is included in all the algorithms.

Checking to see if space is available in the AVAIL list. If not
then AVAIL = NULL, then the algorithm will print the
message OVERFLOW.

Removing the first node from the AVAIL list. Using the
variable N to keep track of the location of the new node, this
step can be implemented by the pair of assignments
N := AVAIL, AVAIL := LINK [AVAIL]
3
 Copying new data into the new node. DATA [N] := ITEM
What is queue? Briefly explain array implementation of queue.
U3/39,4
0
5+5
10
Queue - A queue is a linear list of elements in which deletions
can take place only at one end, called the front and insertions
can take place only at the other end, called the rear as referred
in the below figure. The terms “front” and “rear” are used in
describing a linear list only when it is implemented as a queue.
Following are the two methods offered by queue for adding and
deleting element from the queue.
4
A

enqueue - add a new item at the back of the queue

dequeue - remove the item at the front of the queue
Array implementation of queue - Since a queue usually holds a
bunch of items with the same type, we could implement by
means of one way list or linear array. Here the queue in a linear
way is maintained with two pointers called FRONT, containing
the location of the front element of the queue and REAR, to hold
the location which is at rear. Insertion and deletion of element is
not handled as the normal array where we shift the elements
forward or backward. Here, whenever the element is deleted
from the queue the value of the FRONT is increased by 1 this
can be implemented by FRONT: =FRONT+1……..
Write a short note on: NP-Completeness and Optimization
versus decision problems.
The ‘NP’ stands for ‘nondeterministic polynomial time’, which
says about the fact that a solution for certain type of a problem
can be checked (but may not be found) in polynomial time. This
class of algorithms informally indicates that there is a
polynomial time for checking a solution for a problem whose
solution may be difficult to be found out………….
U7/121,
122
5+5
10
U11/202
,203
10
10
Any problem for which the answer is either in the form of YES or
NO is called a decision problem. An algorithm for a decision
problem is termed a decision algorithm.
Any problem that involves the identification of an optimal
solution (where some value needs to be found out as minimized
or maximized) is known as an optimization problem. An
optimization algorithm is used to solve an optimization
problem………
5
Write the Algorithm to find the maximum and minimum items in
a set of ‘n’ element.
A
6
A
Briefly explain Greedy Method Strategy.
The greedy method suggests that one can device an algorithm
that works in stages, considering one input at a time. At each
stage, a decision is made regarding whether a particular input is
in an optimal solution.
This is done by considering the inputs in an order determined by
some selection procedure.
If the inclusion of the next input into the partially constructed
optimal solution will result in an infeasible solution, then this
input is not added to the partial solution. Otherwise, it is added.
The selection procedure itself is based on some optimization
measure.
This measure may be the objective function. This version of the
greedy technique is called the subset paradigm.
U12/215
10
10