Operations on sequential files, Data Structure & Algorithms

Assignment Help:

Insertion: Records has to be inserted at the place dictated by the sequence of keys. As is obvious, direct insertions into the main data file would lead to frequent rebuilding of the file. This difficulty could be mitigated by reserving' overflow areas' in the file for insertions. However, this leads to wastage of space. The common method is to employ transaction logging. This works as follows:

  • It gathers records for insertion in a transaction file in their order of their arrival.
  • While population of the transactions file has ceased, sort the transaction file in the order of the key of the primary data file
  • Merge the two files on the basis of key to obtain a new copy of the primary sequential file.

Usually such insertions are done in a batch mode while the activity/program which populates the transaction file have ceased. The structure of the transaction files records will be identical to that of the primary file.

2. Deletion: Deletion is the reverse procedure of insertion. The space occupied by the record must be freed for use. Usually deletion (like-insertion) is not done instantly. The concerned record is written to a transaction file. During merging, the corresponding data record will be dropped from the primary data file.

3. Updation: Updation is a combination of insertion & deletions. The record with the new values is inserted and the earlier version deleted. It is also done using transaction files.

4. Retrieval: User programs will frequently retrieve data for viewing prior to making decisions. Thus, it is essential that this data reflects the latest state of the data, if the merging activity has not still taken place.

Usually, Retrieval is done for a particular value of the key field. Before return in to the user, the data record must be merged with the transaction record (if any) for that key value.

The other two operations 'creation' & 'deletion' of files are attained by simple programming language statements.


Related Discussions:- Operations on sequential files

Registers, what are registers? why we need register? Definition? Types? Wha...

what are registers? why we need register? Definition? Types? What registers can do for us?

Sparse matrix, How sparse matrix stored in the memory of a computer?

How sparse matrix stored in the memory of a computer?

Define tractable and intractable problems, Define tractable and intractable...

Define tractable and intractable problems Problems that can be solved in polynomial time are known as tractable problems, problems that cannot be solved in polynomial time are

Algorithm.., write an algorithm to sort given numbers in ascending order us...

write an algorithm to sort given numbers in ascending order using bubble sort

Program segment for insertion of an element into the queue, Program: Progra...

Program: Program segment for insertion of an element into the queue add(int value) { struct queue *new; new = (struct queue*)malloc(sizeof(queue)); new->value = val

Algorithm for similar binary tree, Q. The two Binary Trees are said to be s...

Q. The two Binary Trees are said to be similar if they are both empty or if they are both non- empty and left and right sub trees are similar. Write down an algorithm to determine

What is a binary search tree (bst), What is a Binary Search Tree (BST)? ...

What is a Binary Search Tree (BST)? A binary search tree B is a binary tree every node of which satisfies the three conditions: 1.  The value of the left-subtree of 'x' is le

What is Oscillating Sort?, For the Oscillating sort to be applied, it is ne...

For the Oscillating sort to be applied, it is necessary for the tapes to be readable in both directions and able to be quickly reversed. The oscillating sort is superior to the po

Perform inorder, QUESTION (a) Construct a binary tree for the following...

QUESTION (a) Construct a binary tree for the following numbers assuming that a number greater than the node (starting from the root) goes to the left else it goes to the right.

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd