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

Define data model, Define data model?  A data model is a collection of ...

Define data model?  A data model is a collection of conceptual tools for explaning data, data relationships, data semantics and consistency constraints.

State the ruby programming language, The Ruby Programming Language Alth...

The Ruby Programming Language Although data structures and algorithms we study aren't tied to any program or programming language, we need to write particular programs in speci

Multidimensional array in one dimensional array, Q. By giving an example sh...

Q. By giving an example show how multidimensional array can be represented in one the dimensional array.

Darw a flowchart to inputs top speeds of 5000 cars, Write an algorithm in t...

Write an algorithm in the form of a flowchart that: inputs top speeds (in km/hr.) of 5000 cars Outputs fastest speed and the slowest speed Outputs average (mean) s

The various ways in which lc code can be accessed, Problem Your LC code...

Problem Your LC code is stored in a memory location as shown and the variable name is LC                  LC Memory address       Content(LC code)

Algorithm for binary search, Q. Write down the algorithm for binary search....

Q. Write down the algorithm for binary search. Which are the conditions under which sequential search of a list is preferred over the binary search?

Calculates partial sum of an integer, Now, consider a function that calcula...

Now, consider a function that calculates partial sum of an integer n. int psum(int n) { int i, partial_sum; partial_sum = 0;                                           /* L

Representing sparse matrix in memory using array, Q. What do you understand...

Q. What do you understand by the term sparse matrix? How sparse matrix is stored in the memory of a computer? Write down the function to find out the transpose of a sparse matrix u

Dgsd, Ask question #sdgsdgsdginimum 100 words accepted#

Ask question #sdgsdgsdginimum 100 words accepted#

Postfix expression algorithm, Write an algorithm to calculate a postfix exp...

Write an algorithm to calculate a postfix expression.  Execute your algorithm using the given postfix expression as your input : a b + c d +*f ↑ . T o evaluate a postfix expr

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