Question

In: Computer Science

Consider a file with a large number of Person(id, name, birth-date) records. Assume that users frequently...

Consider a file with a large number of Person(id, name, birth-date) records. Assume that users frequently search this file based on a the field id to find the values of name or birthdate for people whose information is stored in the file. Moreover, assume that users rarely update current records or insert new records to the file. Which file structure, heap versus sorted, provides the fastest total running time for users’ queries over this file? Explain your answer.

Solutions

Expert Solution

Sorted file structure gives the fastest runtime for the users for any operation on files such as addition of new records, deletion of records etc.

In this Soreted file system data will be stored in ordered form where as in heap file structure data is not stored in ordered form. In heap structure data will be stored in memory blocks which are free without any order.

Using sorted file structure when doing different operations on files it gives the efficient and fastest result, because of the ordered nature compiler will easily Scan and finds out the required position whereas in the heap structure it is very time consuming process to search a file in unordered memory blocks to update, delete or to add files .

So that the sorted file structure is the best suggested one. Here users frequently access files or add's new files etc., It consumes time when access or updates files using heap structure ,so the efficient and the fastest resolution of user queries is accomplished with the Sorted file structure.


Related Solutions

Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth...
Create a table ‘StudentInfo’ with following fields: ID First Name Last Name SSN Date of Birth Create a table ‘ClassInfo’ table: ID Class Name Class Description Create a table ‘RegisteredClasses’ table: StudentID ClassID The RegisteredClasses table should have a foreign key relationship to StudentInfo and ClassInfo tables for the respective IDs. Also the IDs in StudentInfo and ClassInfo need to be primary keys. When you submit the file your email should also contain the following SQL Queries: Query to show...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name...
Consider the following relation AIRLINE TABLE Flight Date Flight ID Origin Destination Captain ID Captain Name Number of Passengers on the Flight April 10 111 Chicago L.A. 111 Tracy 110 April 10 222 L.A. Phoenix 222 Matt 105 April 12 111 Chicago L.A. 444 Tim 98 April 12 333 L.A. N.Y. 111 Tracy 75 April 12 444 L.A. N.Y. 333 Pat 110 April 12 555 L.A. Dallas 444 Tim 111 April 12 222 L.A. Phoenix 555 Pat 107 Some of...
Create a program that allows a user to input customer records (ID number, first name, last...
Create a program that allows a user to input customer records (ID number, first name, last name, and balance owed) and save each record to a file. When you run the main program, be sure to enter multiple records. Once you create the file, open it and display the results to the user Save the file as  CustomerList.java
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department...
Employee ID First Name Last Name email Title Address Extension Department Department ID Hiring Date Department Phone # 0001 John Smith jsmith Accountant 1300 West st 5775 Accounting 2100 8/1998 407-366-5700 0002 Brian Miller badams Admin Assistant 1552 Palm dr 5367 Human resource 2300 4/1995 407-366-5300 0003 James Miller miller Inventory Manager 2713 Buck rd 5432 Production 2520 8/1998 407-366-5400 0004 John Jackson jackson_sam Sales Person 433 tree dr 5568 Sales 2102 6/1997 407-366-5500 0005 Robert Davis Davis Manager 713...
I have a CSV file with 6 column Issue id action id Issue category Issue date...
I have a CSV file with 6 column Issue id action id Issue category Issue date Issue Closed Date Issue Type Please write a code in Python that counts the number of issues in each category and the earliest and latest issue date for each category. Example of csv Issue id action id Issue category Issue date Issue Closed Date Issue Type 23 1 Noise Complaint 7/19/2020 7/22/2020 Client Complaint 24 1 Cleanliness Complaint 7/19/2020 7/23/2020 Sanitation 25 2 Site...
Consider the following XML file: <root> <students> <element> <ID>100345</ID> <Nationality>USA</Nationality> <Program>ICT</Program> <age>23</age> <name>John</name> </element
Consider the following XML file: <root> <students> <element> <ID>100345</ID> <Nationality>USA</Nationality> <Program>ICT</Program> <age>23</age> <name>John</name> </element> <element> <ID>100876</ID> <Nationality>MALAYSIA</Nationality> <Program>CS</Program> <age>28</age> <name>Awang</name> </element> <element> <ID>100257</ID> <Nationality>AUSTRALIA</Nationality> <age>25</age> <name>Alex</name> </element> </students> </root Write an XQUERY to display the information for all students who are not Malaysians or older than 25.
File has a format Name and number, the number represents power. The name and the (integer)...
File has a format Name and number, the number represents power. The name and the (integer) power are separated by some amount of space. Importantly, any line that begins with a hash '#' are comments and they need to be ingored. Write a program that reads from that file, and prints out only the name of the hero with the strongest power. That name should be capitalized (not uppercase, but capitalized, as in 'Galadriel') Here is the heroes.txt # DC...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is 2,...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
Write an SQL query that will output the employee id, first name and hire date from...
Write an SQL query that will output the employee id, first name and hire date from the employee table. Pick only those employees whose employee ID is specified in the employee table (no nulls). If the employee id is 777, name is ABC and hire date is 01-JAN-2016, the output should be like - ' ABC (Employee ID - 777) was hired on 1, January of 2016'. Note - The date should not have preceding zeros.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT