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

Dqueue, how can i delete from deque while deletion is restricted from one e...

how can i delete from deque while deletion is restricted from one end

What is a linear array, What is a linear array? An array is a way to re...

What is a linear array? An array is a way to reference a series of memory locations using the similar name. Every memory location is shown by an array element. An  array elemen

Linked lists, representation of links list in memory

representation of links list in memory

Representation of linked list in memory, Representation of Linked list in M...

Representation of Linked list in Memory:- Each node has an info part and a pointer to the next node also known as link. The number of pointers is two in case of doubly linked

Queue, 1. Show the effect of each of the following operations on queue q. A...

1. Show the effect of each of the following operations on queue q. Assume that y (type Character) contains the character ‘&’. What are the final values of x and success (type boole

Discuss the brute force algorithm, Question 1 What do you mean by Amortiza...

Question 1 What do you mean by Amortization? Question 2 Explain the following Big Oh notation (O) Omega notation (Ω) Theta notation (Θ)   Question 3 Di

Complexity of an algorithm, Q. Explain the complexity of an algorithm?  Wha...

Q. Explain the complexity of an algorithm?  What are the worst case analysis and best case analysis explain with an example.

Two-dimensional array, Two-dimensional array is shown in memory in followin...

Two-dimensional array is shown in memory in following two ways:  1.  Row major representation: To achieve this linear representation, the first row of the array is stored in th

Declaring a two dimensional array, Declaring a two dimensional array   A...

Declaring a two dimensional array   A two dimensional array is declared same to the way we declare a one-dimensional array except that we state the number of elements in both di

Small program on Algorithms , Objective The goal of this project is to ext...

Objective The goal of this project is to extend and implement an algorithm presented in the course and to apply notions introduced by the course to this program/algorithm. The ass

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