0% found this document useful (0 votes)
131 views2 pages

Data & File Structure Exam Overview

This document is the exam for a Data & File Structure course being taken during the fall semester of 2005 at Pokhara University. It contains 7 questions testing various concepts related to data structures and file processing. Students are required to answer all questions in their own words within the allotted 3 hour time limit. The questions cover topics like sparse matrices, linked lists, stacks, queues, trees, sorting algorithms, file organization, directory structures, and more. Full marks are awarded based on comprehensively answering each sub-question.

Uploaded by

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

Data & File Structure Exam Overview

This document is the exam for a Data & File Structure course being taken during the fall semester of 2005 at Pokhara University. It contains 7 questions testing various concepts related to data structures and file processing. Students are required to answer all questions in their own words within the allotted 3 hour time limit. The questions cover topics like sparse matrices, linked lists, stacks, queues, trees, sorting algorithms, file organization, directory structures, and more. Full marks are awarded based on comprehensively answering each sub-question.

Uploaded by

Adhikari Sushil
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

POKHARA UNIVERSITY

Level: Bachelor Semester – Fall Year : 2005


Programme: BE Full Marks: 100
Course: Data & File Structure 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 sparse matrix? How it can be represented in a linked list? 9


Write procedure to add two sparse matrices represented in linked
lists.
b) Convert the following infix expression into postfix expression 6
showing stack step by step in tabular form.
Infix: (A-B/C) *(D * E – F)
2. a) What is linked list? Discuss its types. What are the advantages and 8
disadvantages of linked list over array?
b) Write C/C++ functions to insert and to delete an item in queue in
circular representation. 7
3. a) Explain briefly the concept of AVL trees? Explain how you can 8
restore the balance property of AVL tree when inserting/deleting a
node violates its property. Illustrate with examples.
b) What do you mean by priority queue? Which is the most suitable 7
way to implement it? Discuss with an example.
4. a) Give outline of Divide and Conquer sorting. Trace sort algorithm 10
with following data:
13, 81, 92, 43, 65, 31, 57, 26, 26, 75, 0
b) Construct an expression tree from the following post – fix 5
expression:
ABCD - + $ * EF*- and get prefix equivalent
OR
Construst BST:
25,15,30,20,30,27,17,4,23,26,22 and show deletion of 27, 17 & 25

5. a) What is File Structure? Discuss the common operations in Files. 7


b) How is data organized in Magnetic Tape? Suppose we want to store 8
backup copy of a large mailing list file with one million 100 byte
records. If we want to store the file on a 6250 bpi tape that has an
inter-block gap of 0.3 inches, how much tape is needed? If B.F is 50,
what is the effect?
6. a) Explain and how the UNIX directory structure. 7
b) Explain physical and logical files. What are the fundamental file 8
processing operations? Explain in brief.
7. Write short notes on (Any Two) 52
a) Addressing in CD – ROM's
b) TOH problem
c) 2-3 trees
d) Double ended Queue and implementation

Common questions

Powered by AI

2-3 trees differ from binary search trees by allowing nodes to contain two or three children and one or two keys, maintaining sorted order within nodes. This structure inherently guarantees balance, avoiding degradation to linked list forms as seen in unbalanced binary search trees. 2-3 trees restructure only when nodes exceed three children or keys, promoting efficient operations and ensuring balanced height and improved search times. Unlike AVL or Red-Black trees, 2-3 trees maintain balance through node key management rather than external re-balancing rotations .

A priority queue is most efficiently implemented using a heap structure due to its ability to maintain the order of elements according to priority with optimal time complexities for insertion and removal. An example usage is in task scheduling systems where higher-priority tasks are dequeued ahead of others regardless of their arrival times. Using a max-heap allows quick access to the highest-priority task, while a min-heap can provide the lowest-priority element. This implementation ensures efficient operations suited for dynamic datasets .

Fundamental file processing operations include opening, reading, writing, closing, and deleting files. Physical files refer to the actual storage of data on a hardware medium, while logical files represent the abstracted way users and programs interact with stored data. These operations abstract physical data handling into logical processes, making data manipulation intuitive and efficient for users and applications. Understanding this separation enables efficient file system management and data integrity across various storage media .

The primary advantage of linked lists over arrays is their dynamic sizing capability, allowing efficient insertions and deletions without resizing. Linked lists can save memory compared to fixed-size arrays due to this flexibility. However, linked lists have disadvantages such as higher memory usage per element because of the need to store pointers, and they often have slower access times due to non-contiguous memory storage, requiring traversal from the head to access a specific element, unlike direct indexing in arrays .

Sparse matrices can be represented using linked lists by creating a node for each non-zero element, which stores the element’s value, row, and column indices. Each node is linked sequentially according to row and column order. To add two sparse matrices represented as linked lists, traverse both lists comparing row and column indices. If indices match, add the values; if not, append the node from the matrix with the smaller index to the result list. Continue until both lists are exhausted. This method efficiently handles matrices with a large number of zero elements .

Divide and Conquer sorting involves recursively breaking down the dataset into smaller subsets until manageable units are obtained, each of which can be sorted simply. These units are then combined in a manner that results in a complete sorted dataset. Applying this to the sequence 13, 81, 92, 43, 65, 31, 57, 26, 26, 75, 0, the dataset is divided into halves, each sorted by further splits, with iterative merging leading to a completely sorted array. This technique is fundamental to algorithms like Merge Sort .

To restore the balance in an AVL tree after inserting or deleting a node, rotations are performed to maintain the height difference of no more than one between left and right subtrees. For insertion, a single or double rotation (left-right or right-left) is applied based on the imbalance pattern detected (left-left, left-right, etc.). Example: inserting a node causing left-right imbalance requires left rotation on the node's left child followed by right rotation on the root. Similarly, deletions causing imbalance undergo appropriate rotations depending on which side the additional node depth affects .

A double-ended queue (deque) allows insertion and deletion of elements at both ends, offering more flexibility compared to regular queues. This can be implemented using a linked list where nodes are added or removed at both the head and tail, maintaining efficient operations for operations that involve both ends. Deques support bidirectional iteration crucial for algorithms that require reversed processes, thus providing versatile solutions to symmetrical data processing tasks .

Data on magnetic tapes is organized sequentially, with blocks of data separated by inter-block gaps for proper data retrieval. The block factor (B.F) affects storage efficiency; a larger B.F reduces the number of gaps, minimizing wasted space. For instance, storing a large mailing list file with inter-block gaps of 0.3 inches requires precise calculations considering tape density and block sizes to appropriately size the necessary storage length. Efficient block usage maximizes data storage capability on accessible length of tape .

Infix to postfix conversion involves rearranging operators in relation to operands by following the precedence and associativity rules and utilizing a stack data structure. For (A-B/C)*(D*E-F), push operands directly to the output, push lower precedence operators from the stack when encountering a higher precedence one, and use a stack to maintain order for parentheses. The conversion steps for this expression result in: ABC/-DE*F-* when traced stepwise using a stack, ensuring operator precedence and correct associative handling .

You might also like