Skip to content

The file of Discrete Structures of I year II semester

License

Notifications You must be signed in to change notification settings

jarvis-1805/CPP-FILE

Repository files navigation

CPP-FILE

File of Discrete Structure of I year II semester.

Practical List

Question No. Question
Ques 1 Write a Program to create a SET A and determine the cardinality of SET for an input array of elements (repetition allowed) and perform the following operations on the SET:
a) ismember (a, A): checkwhether an element belongs to set or not and return value as true/false.
b) powerset(A): list all the elements of power set of A.
Ques 2 Create a class SET andtake two sets as input from user to perform following SET Operations:
a) Subset: Check whether one set is a subset of other or not.
b) Unionand Intersection of two Sets.
c) Complement: Assume Universal Set as per the input elements from the user.
d) Set Differenceand Symmetric Difference between two SETS.
e) Cartesian Productof Sets.
Ques 3 Create a class RELATION, use Matrix notation to represent a relation. Include functions to check if a relation is reflexive, Symmetric, Anti-symmetric and Transitive. Write a Programto use this class.
Ques 4 Use the functions defined in Ques 3 to find check whether the given relation is:
a) Equivalent, or
b) Partial Order relation, or
c) None
Ques 5 Write a Program to generate the Fibonacci Series using recursion.
Ques 6 Write a Program to implement Tower of Hanoi using recursion.
Ques 7 Write a Program to implement binary search using recursion.
Ques 8 Write a Program to implement Bubble Sort. Find the number of comparisons during each pass and display the intermediate result.Use the observed values to plot a graph to analyse the complexity of algorithm.
Ques 9 Write a Program to implement Insertion Sort. Find the number of comparisons during each pass and display the intermediate result. Use the observedvalues to plot a graphto analyse the complexity of algorithm.
Ques 10 Write a Program that generates all the permutations of a given set of digits, with or without repetition. (For example, if the given set is {1,2}, the permutations are 12 and 21). (One method is given in Liu)
Ques 11 Write a Program to calculate Permutation and Combination for an input value nand r using recursive formula of nCr and nPr.
Ques 12 For any number n, write a program to list all the solutions of the equation x1 + x2 + x3 + ...+ xn= C, where C is a constant (C<=10) and x1, x2,x3,...,xn are non-negative integers using brute force strategy.
Ques 13 Write a Programto accept the truth values of variables x and y, and print the truth table of the following logical operations:
a) Conjunction    f) Exclusive NOR
b) Disjunction     g) Negation
c) Exclusive OR    h) NAND
d) Conditional     i) NOR
e) Bi-conditional
Ques 14 Write a program to accept an input nfrom the user and graphically represent the valuesof T(n) where n varies from 0 to n for the recurrence relations. For e.g. T(n) = T(n-1) + n, T(0) = 1, T(n) = T(n-1) + n^2, T(0) =1, T(n) = 2*T(n)/2 + n, T(1)=1.
Ques 15 Write a Program to store a function (polynomial/exponential), and then evaluate the polynomial. (For example store f(x) = 4n^3+ 2n + 9 in an array and for a given value of n, say n = 5, evaluate (i.e. compute the value of f(5)).
Ques 16 Write a Program to represent Graphs using the Adjacency Matrices and check if it is a complete graph.
Ques 17 Write a Program to accept a directed graph G and compute the in-degree and out-degree of each vertex.
Ques 18 Given a graph G, Write a Program to find the number of paths of length nbetween the source and destination entered by the user.
Ques 19 Given an adjacency matrix of a graph, write a program to check whether a given set of vertices {v1, v2, v3....., vk} forms an Euler path/ Euler Circuit (for circuit assume vk=v1).
Ques 20 Given a full m-ary tree with iinternal vertices, Write a Program to find the number of leaf nodes.

It also contain some of the random practice questions.

Author

Shubhang Gupta
@shubhsahu1805

About

The file of Discrete Structures of I year II semester

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages