BCA2020 -DATA STRUCTURE AND 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

 

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 question is followed by evaluation scheme.

 

 

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 databases and internet

 

 

 

2 Briefly explain Insertion Algorithms.

 

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, insertion sort provides several advantages:

 

Simple implementation: Bentley shows a three-line C version, and a five-line optimized version.

Efficient for (quite) small data sets

More efficient in practice than most other simple quadratic algorithms such as selection sort or bubble sort

 

 

 

3 What is queue? Briefly explain array implementation of queue.

 

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 performs the function of a buffer.

 

 

 

 

4 Write a short note on: NP-Completeness and Optimization versus decision problems.

 

Answer: NP-Completeness: NP-completeness is a form of bad news: evidence that many important problems can’t be solved quickly.

These NP-complete problems really come up all the time. Knowing they’re hard lets you stop beating your head against a wall trying to solve them, and do something better:

  • Use a heuristic. If you can’t quickly solve the problem with a good worst case time, maybe you can come up with a method for solving a reasonable fraction of the common cases.
  • 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 solution you can prove is close to right.

 

 

5 Write the Algorithm to find the maximum and minimum items in a set of ‘n’ element.

 

Answer:

  1. Algorithm MaxMin (i,j, max, min)
  2. // a[1:n] is a global array Parameter i and j are integers,
  3. // 1 „T i „T j < n. The effect is to set max and min to the
  4. // largest and smallest values in a [i, j], respectively.
  5. {
  6. if (i=j) then max:=min:=a[i]; //small(P)
  7. else if (i = j ¡V 1) then //Another case of Small (P)
  8. {
  9. if a [i] < a[j] then
  10. {
  11. max:=a[j]; min:=a[i];
  12. }
  13. else
  14. {
  15. max:=a[i]; min:=a[j]

 

 

 

 

6 Briefly explain Greedy Method Strategy.

 

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 solutions will finally add up to a globally optimal 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, among all possible ways of picking out these k numbers.

To solve this problem, one may test all possible ways of picking k numbers out of these n numbers. That is , of course, a foolish way of solving this

 

Dear students get fully solved assignments

Send your semester & Specialization name to our mail id :

 

“ help.mbaassignments@gmail.com ”

or

Call us at : 08263069601

 

Leave a Reply