Assignments

advertisement
 ASSIGNMENT NO:-1
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Explain data structure & types of data structure with example.
What is stack? Explain with example.
Which operations are performed on stack. OR Define stack & Write push & pop function of stack.
What is queue & it’s operations.
What is circular queue &it’s operations.
What is priority queue & it’s operations.
Write a program for stack using array.
Write a program for queue using array.
Write a program for circular queue using array.
Write a program for stack using array.
Insert following elements in stack of size 5( 5,10,15,20,25) & do the following operation
a)pop
b)push 50
c)push 25
d)pop
e)push 30
12. Explain what is Dequeue along with it’s type.
(5)
13. Write a program on stack of size 7 and push elements in stack from last position of stack.
14. Define a function to check overflow & underflow condition of queue.
15. Differentiate between queue & Circular queue.
16. Explain the algorithm for converting infix to postfix expression with example.
17. Explain the algorithm for converting postfix to infix expression with example.
18 . What is value of following postfix expression?
579*+493/+19. Write down the equivalent infix expression for the following postfix expression.
ABC-/ADE+*
20) Convert following infix expression to postfix expression.
(5)
i) (a + b) * (c + d)
ii) a - (b + c) * d / e
iii) h + (j ^ k) * I % s
21. Write a program on stack of size 7 & pushed elements in stack from last position of stack. (10)
22. Write a program on stack of size 8 & pushed elements in stack from 2nd position of stack. (10)
 ASSIGNMENT NO:-2
1.What is List ? Explain operations on list with example.
2.What is Linked List ? List types of Linked List.
3.What is Singly Linked List explain with it’s all operations.
4. What is Circular Linked List explain with it’s all operations.
5. What is Doubly Linked List explain with it’s all operations.
6.Write a algorithm for representation & adding two polynomials using Linked List.
OR
Write a algorithm for summing two polynomials using linked list.
7. Illustrate addition of two polynomials using linked list
1) 3x^4+ 4X^2 + 2X+5
and 2) 2x^3+3x+7
(5)
8. Explain the concept of free node & get node with respect to avail list.(5)
10. Write program on implementation of queue using linked list & define subroutine to enq,
deq,display.(10)
11. Write a program for Singly Linked List which performs following operations.
(10)
1) inert beginning
2)deletebeg
3)display
12.Write a program for Singly Linked List which performs following operations.
(10)
1) inert end
2)deletend
3)display
 ASSIGNMENT NO:-3
1.
2.
3.
4.
5.
6.
7.
8.
9.
What is recursion explain with example.
Explain the concept of tower of hanoi with fig.
Write a program for tower of Hanoi using recursion.
Write a program for fobonacci sequence using recursion.
Write a program for GCD(Greatest Common Divisor) using recursion.
Write a program for multiplication of two numbers using recursion.
Explain advantages & Disadvantages of recursion.
(5)
What is difference between recursive function & iterative function?
Determine what the following recursive C function computes. Write an iterative function to
accomplish the same purpose.
Int factorial( int n)
{
If(n<=1)
Return 1;
Else
Return n* factorial(n-1);
}
 ASSIGNMENT NO:-4
1. Define the following terms with an example.
a. Tree
b. Binary tree
c. Complete binary tree
d. Strictly binary tree
e. Almost complete binary tree
f. Binary search tree
g. Root
h. Leaf
i. Internal node
j. Ancestor
k. Descendent
l. Siblings
m. Level or depth of a node
n. Height of a tree
o. Degree of a node
p. Degree of a tree
q. Indegree
r. Outdegree
s. Heap
2. Explain what are the operation which can be performed on tree ? Explain in detail searching operation
with suitable example & algorithm.
3. Explain what are the operation which can be performed on binary tree ? Explain in detail searching
operation with suitable example & algorithm.
(10)
4. Explain two storage representations of a binary tree with an example.
5.What are the 3 traversal techniques of binary tree? Traverse the following trees in inorder,
preorder and postorder.
6. Explain what are the operation which can be performed on binary search tree ? Explain in detail searching
operation with suitable example & algorithm.
7. What is binary search tree ? Explain advantages of binary search tree over binary tree.
8. Explain conversion of General tree to binary tree with suitable example & diagram.
9. What are the 3 traversal techniques of binary search tree? Explain with example.
10. Write algorithm to insert new node in tree.
(5)
11.Assume the following information is read in a given order for tree.
10,20,15,14,30,40,7,9,35,50.If the tree is initially empty , how would a binary tree look like after
inserting the nodes in a given order. (5)
12. Write a note on applications of tree.
 ASSIGNMENT NO:-5
1.
Define the following terms with an example.
a. Graph
b. Directed graph
c. Undirected graph
d. Weighted graph
e. Connected graph
f. Strongly connected graph
g. Weakly connected graph
h. Complete graph
i. Simple graph
j. Path
k. Simple path
l. Closed path or Cycle
m. Cyclic graph
n. Acyclic graph
o. Degree of a node
p. Indgree of a node
q. Outdegree of a node
r. Degree of a node
2. Explain storage representations techniques of a graph with an example.
3. Explain an algorithm for BFS traversal technique with an example.
4. Explain an algorithm of DFS traversal technique with an example.
5. Differentiate BFS and DFS traversal techniques with an example?
6 Explain storage representations techniques of a graph & represent the following graph(A,B,C) using
1) Adjacency Matrix Representation
A
A
B
2) Adjacency List representation.
A
C
B
C
B
B
D
(A)
D
(B)
C
(C)
(10)
 ASSIGNMENT NO:-6
1. Why sorting is required explain with example? List different types of sorting techniques.
2. Explain Bubble Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases (Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
3. Explain bubble sort technique for sorting of ten integers. (5)
4. Explain Insertion Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases(Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
5. Explain Selection Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases(Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
6. Explain Merge Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases(Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
7. Explain Quick Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases(Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
8. Explain Radix Sort with following points.
i) Algorithm
ii) Solve example.
iii) Time complexity in all 3 cases(Best case ,Worst case, Average case.)
iv) Advantages & Disadvantages.
9. Sort the following numbers using Bubble Sort: 13, 33, 27, 77, 12, 43, 10, 432, 112, 90
10. Sort the following numbers using insertion sort: 7, 1, 3, 4, 10, 9, 8, 6, 5, 2
11. Sort the following numbers using selection sort: 25, 57, 48, 37,12,92,86,33
12. Write a c code for performing merging &sorting & Sort the following numbers using merge sort:
10,1,9,11,46,20,15,0,72,2
13. Sort the following numbers using Quick sort:10,22,65,223,87,343,98,244,543,22,4
14. Sort the following numbers using Radix Sort. Show the status after each step:
12,92,20,16,62,22,58,34,55,36,40
(10)
15.What is the purpose of ‘O’ notation.
 ASSIGNMENT NO:-7
1. What is meant by searching? List different types of searching techniques.
2. Explain linear search with its algorithm & example.
OR
Explain linear search & write advantages of binary search method. (5)
3. Write a program for Linear Search using arrays.
4. Explain binary search with its algorithm & example.
5. Write a program for Binary Search using arrays.
6. Find the best case, worst case and average case time complexity of linear and binary search.
7. Compare Linear (sequential) search and Binary search with its advantages & Disadvantages.
8. Explain the properties of good hash function.
9. What is hashing? Explain hash collision.
10. Explain hash functions with an example.
(5)
11. What is Hash collision? Explain collision resolution techniques with example. OR Explain open &
closed hashing .
12. Explain open hashing & closed hashing methods to resolve collision.
(10)
Insert a numbers 37, 38, 72, 48,98,11,56 into a table size 7 using both methods .show corresponding
diagrams.
(hash function f(k)=key % table size)
13. Explain the collision resolution with open addressing .
Download