0% found this document useful (0 votes)
45 views4 pages

DAA Practical Question For Reference

Uploaded by

a90685766
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views4 pages

DAA Practical Question For Reference

Uploaded by

a90685766
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

DAA Practical question bank

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

● Generate a binary string of length N using branch and bound technique.


(Input: N = 3 Output: 000 001 010 011 100 101 110 111 Explanation: Numbers
with 3 binary digits are 0, 1, 2, 3, 4, 5, 6, 7 Input: N = 2 Output: 00 01 10 11)

● Suppose we want to make an exam schedule for a university. We have listed


different subjects and students enrolled in every subject. Many subjects would
have common students (of the same batch, some backlog students, etc). How do
we schedule the exam so that no two exams with a common student are scheduled
at same time? How many minimum time slots are needed to schedule all exams?
This problem can be represented as a graph where every vertex is a subject and an
edge between two vertices means there is a common student. So this is a graph
coloring problem where the minimum number of time slots is equal to the
chromatic number of the graph. Write a Scilab program to solve the above problem.
● Write a Scilab program to solve a problem of maze by applying an appropriate
Algorithm.

● 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 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.A suitable
message is to be displayed if the given problem instance doesn't have a solution.

● 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.

● Design and implement in Scilab to find all Hamiltonian Cycles in a connected


undirected Graph G of n vertices using backtracking principle.
DAA Practical question bank

● 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.

You might also like