Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
21 views

Assigment of Data Structure and Algorithm For BE SE Third Sem 1

Data structure and algorithm assignment

Uploaded by

Dinesh Baniya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Assigment of Data Structure and Algorithm For BE SE Third Sem 1

Data structure and algorithm assignment

Uploaded by

Dinesh Baniya
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Data Structure and Algorithm

Assignment #1
Submission deadline: Aug 31, 2020. 12:00 Noon Kathmandu Time
Online Viva (Your main Examination): Sept 2, 2020 (For more info see at TEAMS post)

Instructions:
1. It is a mandatory assignment. But, it is not your EXAMINATION. It carries 5 points
mark for your internal evaluation.
2. If someone who don’t submit this assignment won’t be allowed to take viva.
3. Absent or fail or any inability to appear in viva will make you fail in this course.
4. Students should solve all the question sets provided in this assignment. You can
skip the question if they are repeated and exactly same but you have to specify
there saying the question is repeated. Don't copy from any resource or from your
friends.
5. Clearly specify your Name, Examination roll no, Subject Name in the first page of
your assignment.
6. Marks will be given based on your solutions. Students should do assignment by
own handwriting. If it is needed in future, it will be verified by your handwriting
in your physical presence. If it is failed in verification, it will make you fail in this
course.
7. Students should submit the assignment within the deadline date and time. No
later submissions will be considered and graded.
8. The submission deadline is Aug 31, 2020 by 12:00 noon (Kathmandu time).
9. Make sure that your handwriting is clearly understandable and clearly readable.
10. After you finished your assignment, provide page number (for example 1 of 20) in
each page, scan the copies of your solutions and use this online pdf editor
(https://www.sejda.com/merge-pdf) to merge all the scans copies with proper
sequence based on page numbers in a single pdf file and summit in TEAMS via
Assignments tab and press "Turned In" button in the top right.
11. Don't submit your assignment in post or chat box. The assignments posted in
post and chat box won't be considered and graded.
POKHARA UNIVERSITY

Level: Bachelor Semester: Spring Year : 2012


Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) Define stack. Convert the given expression into postfix expression 8


showing the content of stack at each step:
( A + B ) $ (C * ( D + E ) - F ) – G * H
b) What do you mean by data structure? Explain about abstract data type 7
(ADT) with suitable example.
2. a) Explain stack and queue as a list with the help of suitable example. 8
b) Explain stack and queue as a list with the help of suitable example. 7
Mention the merits and demerits of Circular Queue over a Linear
Queue. Create a pseudo code with appropriate diagram in order to add
all the integers in the given linked list:
50 20 13 33 5 60 NULL

Start

3. a) Define linked list as an ADT. And also write algorithm to insert an 8


element before, between and after node.
b) Differentiate between recursion and iteration. Provide recursive 7
algorithm for generating Fibonacci sequence.
4. a) What are the properties of AVL tree? Explain with example, how can 8
you restore the balance property of an AVL tree when inserting a node
violates its property.
b) Create Binary Search Tree (BST) for following data sequence and 7
traverse the tree in post-order, pre-order and in-preorder: 50, 70, 65,
12, 68, 90, 21, 11, 41.
5. a) Explain the divide and conquer approach in quick sort algorithm? 8
1
Trace the algorithm to sort the following unordered list:
77 36 14 75 17 10 70 12
b) Describe the terms strongly connected graph, degree of a node, loop 7
and cycle, in reference with graph as ADT.
6. a) Define the terms hashing, hash function and collision. Given input { 1, 8
16, 49, 36, 25, 64, 0, 81, 4, 9 } and a hash function h(x) = x mod 10
show the resulting:
i. Hash table using quadratic probing.
ii. Hash table using chaining.
b) Define the minimum spanning tree. Explain the algorithm for finding 7
the minimum spanning tree with an example.
7. Write short notes on: (Any two) 2×5
a) Big O notation
b) Divide and computer algorithm
c) Deterministic and no-deterministic algorithm.

2
POKHARA UNIVERSITY

Level: Bachelor Semester: Fall Year : 2013


Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) What is the difference between data type and data structure? How do 7
you represent Rational number as an ADT?
b) Define stack as an ADT. Enlist any five applications of stack. Convert 8
the given expression into postfix expression showing the content of
stack at each step:
( A + B ) $ (C * D) - E
2. a) Discuss the merits and demerits of contiguous list and linked list. 8
Write algorithms to insert and delete a node in queue implemented in
linked list.
b) “A function or a object calls itself”. Explain this statement using idea 7
behind it. Give recursive algorithms for Fibonacci term and TOH
problem.
3. a) Write down C module to insert an element before, between and after 8
node of singly linked list.
b) What is AVL Tree? Determine the pre order, in order and post order 7
traversal for the following binary tree.

1
4. a) Why sorting is necessary and When radix sort is useful? Trace the 8
following data using radix sort algorithm: 25, 57, 48, 37, 12, 92, 86,
33.
b) Define load factor. Given input { 1, 16, 49, 36, 25, 64, 81, 4, 9, 2 } 7
and a hash function h(x) = x mod 10 show the resulting:
i. Hash table using quadratic probing.
ii. Hash table using chaining.
5. a) Define Big O Notation. What is parallel computing algorithm and 8
When parallel computing algorithm is preferred over the serial one?
b) Find the Minimum Spanning Tree and its weight of the graph using 7
Kruskal’s algorithm:

6. a) Write Dijkstra’s Algorithm to find the shortest path. Explain the 8


algorithm with necessary figure.
b) Draw the Binary Search Tree (BST) for following string considering 7
each character as information of the node in a binary search tree. And
also traverse the tree in post-order, pre-order and in-preorder:
POKHARAUNIVERSITY.
7. Write short notes on: (Any two) 2×5
a) Warshall’s algorithm.
b) Stable and unstable sorting.
c) Dequee operation using linked list.

2
POKHARA UNIVERSITY

Level: Bachelor Semester: Spring Year : 2013


Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) What is data structure? Compare and contrast between primitive and 7


non-primitive data structure.
b) Define stack. Convert the given expression into prefix expression 8
showing the content of stack at each step:
( A + B ) * (C $ D) – E / F
2. a) What is a benefit of circular queue when compared to linear queue? 8
What are the basic operations in a queue? Write an algorithm for any
one of the operations.
b) What is a linked list? Write an algorithm to insert at the beginning of 7
the linked list.
3. a) Why is doubly linked list used? Explain the implementation of a 7
doubly linked list.
b) Compare and contrast between recursion and iteration. Write a 8
recursive algorithm for generating Fibonacci sequence.
4. a) Draw the Binary Search Tree (BST) for following string considering 7
each character as information of the node in a binary search tree. And
also traverse the tree in post-order, pre-order and in-preorder:
DATASTRUCTURE
b) Why balance factor is used in AVL tree? Construct an AVL tree from 8
the following data:
32, 53, 16, 90, 45, 21, 11, 1, 42, 89, 91, 79
5. a) Using selection sort, sort the given data: 8
P, O, K, H, A, R, A, U, N, I, V, E, R, S, I, T, Y
b) What do you mean hashing? Explain about collision resolution 7
technique used in hashing.
1
6. a) Find the Minimum Spanning Tree and its weight of the graph using 8
Prim’s algorithm:

b) Explain about deterministic and non-deterministic algorithm in brief. 7


Also explain about Big-Oh notation with the help of suitable example.
7. Write short notes on: (Any two) 2×5
a) Greedy algorithms
b) Bucket sort
c) Huffman algorithm.

2
POKHARA UNIVERSITY

Level: Bachelor Semester: Spring Year : 2014


Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) Justify the statement "Data Structure is the backbone of software 7


programming". What is ADT?
b) Explain the basic operations of stack. Write an algorithm for insertion 8
and deletion of an element in a stack. Also mention the condition for
overflow and underflow in a stack.
2. a) What is infix, prefix and postfix expression? Convert the following 7
infix expression into postfix expression showing the content of stack
in each step.
P=A+(B/C-(D*E$F)+G)*H
b) Compare circular queue with linear queue. Write enqueue and 8
dequeue algorithm of circular queue.
3. a) What are the advantages and disadvantages of linear linked list? Show 7
an algorithm to insert an element at the end and at specified position
of the single linked list.
b) What is doubly linked list (DLL)? How does it differ from circular 8
linked list (CLL).Explain with appropriate example.
4. a) Differentiate recursion with iteration. Write down the algorithm to 7
solve the tower of Hanoi using recursion.
b) Generate the Huffman code for the symbol A, B, C, D, E, F with the 8
probability of occurrence are 0.2, 0.28, 0.2, 0.16, 0.12, 0.04
respectively. Also construct Huffman tree.
5. a) Write the steps required to delete a node form a Binary Search Tree 7
(BST). Re-construct the resulting BST after deleting the node 6 from
the following BST.

1
10
12
6

5 8 11

4 7
9

b) What is sorting? Explain the divide and conquer approach in quick 8


sort algorithm. Trace the algorithm to sort the following unordered
list. 40, 20, 10, 80, 60, 50, 7, 30, 100.
6. a) Define graph. What are the difference between traversing in graph and 7
traversing in tree? Explain with suitable example.
b) 66, 47, 87, 90, 126, 140, 145, 153, 177, 285, 393, 395, 467, 566, 620, 8
735. From above data, store the values into hash table with 20
positions, using division method (key % table size) of hashing and the
linear probing method for resolving collision.
7. Write short notes on: (Any two) 2×5
a) Spanning tree.
b) Deque.
c) Serial and parallel algorithm.

2
POKHARA UNIVERSITY

Level: Bachelor Semester: Spring Year : 2015


Programme: BE Full Marks: 100
Course: Data Structure and Algorithm Pass Marks: 45
Time : 3hrs.

Candidates are required to give their answers in their own words as far
as practicable.
The figures in the margin indicate full marks.
Attempt all the questions.

1. a) "To write an efficient program, we should know about data structure." 5


Explain the above statement.
b) What is ADT? Explain different primitive operations that we can 5
perform on data structures.
c) List the applications of stack in computing as well as non-computing 5
world.
2. a) What is infix, prefix and postfix expression? Convert the following 7
infix expression into postfix expression showing the content of stack
in each step.
P=A+(B*C-(D/E$F)*G)*H
b) Compare circular queue with linear queue. Write Enqueue and 8
Dequeue algorithm of circular queue.
3. a) How dynamic list is different from static list? What are the primitive 7
operations that we can perform in a list? Explain with suitable
example.
b) What is doubly linked list (DLL) and Circular Linked List (CLL)? 8
Write an algorithm to insert a node in specified position of doubly
linked list.
4. a) Define BST. Construct a BST using the following data 7
U, N, I, V, E, R, S, I, T, Y, O, F, P, O, K, H, A, R, A.
Also Perform pre-order, in-order and post order traversal
b) Generate the Huffman code for the symbol A, B, C, D, E, F with the 8
probability of occurrence are 0.2, 0.28, 0.2, 0.16, 0.12, 0.04
respectively. Also construct Huffman tree.
5. a) Why do we need to balance the tree? Perform the balancing algorithm 7
1
according to AVL for the following sequence of numbers.
b) Differentiate bubble sort with selection sort. Explain the divide and 8
conquer approach in quick sort algorithm. Trace the algorithm to sort
the following unordered list. 25, 30, 18, 16, 45, 40, 60, 20, 10, 7, 30,
100, 12, 14.
6. a) Define graph. What are the difference between traversing in graph and 7
traversing in tree? Explain with suitable example.
b) Define Hash Collision. 66, 47, 87, 90, 126, 140, 145, 153, 177, 285, 8
393, 395, 467, 566, 620, 735. From above data, store the values into
hash table with 20 positions, using division method (key%tablesize)
of hashing and the linear probing and quadratic probing method for
resolving collision.
7. Write short notes on: (Any two) 2×5
a) Recursion vs Iteration
b) Deque
c) Serial and Parallel algorithm.

You might also like