DAA Practical Question For Reference
DAA Practical Question For Reference
10 Marks questions
● Write a Scilab program to sort 10 numbers using:
1. Bubble sort in increasing order. [10M]
2. Insertion sort in increasing order. [10M]
3. Merge sort in increasing order. [10M]
● Write a Scilab program to find a number using:
1. Linear search. Accept 5 numbers from the user and number to find. [10M]
2. Binary search. Accept 5 numbers from the user and number to find. [10M]
● Create a random array of n integers. Accept a value X from the user and use linear
search algorithm to check whether the number is present in the array or not and
output the position if the number is present.
● Write a Scilab program to sort a random array of n integers (accept the value of n
from user) in ascending order by using:
4. a quick sort algorithm. [10M]
5. selection sort algorithm. [10M]
6. a counting sort algorithm. [10M]
● Write a Scilab program to perform the following sorting for a given list of
numbers:
Element in array: 5,2,10,4,9,2,18
1. Bubble sort [10M]
2. Insertion sort [10M]
3. Bubble sort [10M]
● Write a Scilab program for the implementation of following:
1. Topological sorting. [10M]
2. n-Queens problem using a backtracking method. [10M]
● Implement an application of DFS such as to find the topological sort of a directed
acyclic graph.
● Write a Scilab program for implementing an application of BFS such as to find
connected components of an undirected graph.
20 Marks questions
● Write a Scilab program to solve the following problem:
Nuts & Bolts Problem (Lock & Key problem) using Quick Sort. Given a set of n nuts
of different sizes and n bolts of different sizes. There is a one-one mapping between
nuts and bolts. Match nuts and bolts efficiently.
Constraint: Comparison of a nut to another nut or a bolt to another bolt is not
allowed. It means a nut can only be compared with a bolt and a bolt can only be
compared with a nut to see which one is bigger/smaller. Another way of asking
this problem is, to give a box with locks and keys where one lock can be opened
by one key in the box. We need to match the pair.
DAA Practical question bank
● Write a Scilab program to find Minimum Cost Spanning Tree of a given connected
undirected graph using Prim’s algorithm.
● Given a set of cities and distance between every pair of cities, the problem is to
find the shortest possible tour that visits every city exactly once and returns to the
starting point.
● Write a program to find the minimum cost spanning tree using Prim’s Algorithm.
DAA Practical question bank
● Write a Scilab program to find shortest paths to other vertices using Dijkstra's
algorithm from a given vertex in a weighted connected graph.
1.
2.
● Write a Scilab program to implement Job sequencing with deadlines using Greedy
Method.
● Write a Scilab program to find a solution for the knapsack problem using greedy
method.
● Find a subset of a given set S = {sl,s2,. ...,sn} of n positive integers whose sum is
equal to a given positive integer d. For example, if S= {1, 2, 5, 6, 8} and d = 9
there are two solutions{1,2,6}and{1,8}.A suitable message is to be displayed if
the a given problem instance doesn't have a solution.
● Let there be N workers and N jobs. Any worker can be assigned to perform any
job, incurring some cost that may vary depending on the work-job assignment. It is
required to perform all jobs by assigning exactly one worker to each job and exactly
one job to each agent in such a way that the total cost of the assignment is minimized.
Write a Scilab program to solve this problem.
● Implement 0/1 Knapsack problem using Dynamic Programming.
● Given a set of cities and distance between every pair of cities, the problem is to
find the shortest possible tour that visits every city exactly once and returns to the
starting point.
1.
2.