Computer Science: An Overview (13th Edition) (What's New in Computer Science)
13th Edition
ISBN: 9780134875460
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 9, Problem 51CRP
Explanation of Solution
Modified
The modified algorithm for “MergeFiles” function is given below:
def MergeFiles(InputFileA , InputFileB , OutputFile ):
If (both input files at EOF):
Stop, with OutputFile empty.
If(InputFileA is not at EOF):
Declare its first record to be its current record.
If(InputFileB is not at EOF):
Declare its first record to be its current record.
If (record of InputFileA and record of InputFileB has same key value)
Then Display only one value
Continue until both input files at EOF.
Algorithm Explanation:
- The given code is used to display the only one value in output file if both files contains the same key value records...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
implementation of Caesar Cipher:You are required to implement the Caesar Cipher encryption/decryption algorithm in Python. Remember to implement the algorithm in such a way that it takes a file as input, encrypts it and store in the current directory. This encrypted file must checkable. The implementation must have a decryption procedure which takes the encrypted file from the current directory, decrypts it and store it with some specific name in the current directory. The name should be different from the original file so that it can be verified.
RCS adopts a reverse delta approach for storing multiple versions of a file. For example, assume a file has three
revisions, 1.1, 1.2, and 1.3, RCS stores the file as of version 1.3, then, the differences between 1.2 and 1.3, and
the differences between 1.1 and 1.2. When a new version is created, say 1.4, the difference between 1.3 and 1.4
is computed and stored, and the 1.3 version is deleted and replaced by 1.4.
Explain why RCS does not simply store the initial version (in this case 1.1) and the differences between each
successive version.
Modify your code so that before the game begins, the player is asked whether they wish to
enter their guesses manually, or to automatically guess based on pre-supplied guesses in a file.
If the first option is chosen, then the game should progress in the same fashion as in the tasks
above. If the second option is chosen, then the following actions should be taken:
Firstly, the player should be asked to enter a filename. If the player enters an invalid filename,
they should be re-prompted until they enter the name of a file that actually exists. This file
should then be read and interpreted as a text file, where each line contains a separate guess.
For example, a sample file input.txt may contain the following text:
1234
4321
5830
8437
1489
3271
2530
You may assume that each line of the file contains a valid guess.
Once the file has been read, then the game should proceed as normal. However, when the
player would be prompted to enter a guess, the next guess in the list of pre-supplied…
Chapter 9 Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Ch. 9.1 - Identify two departments in a manufacturing plant...Ch. 9.1 - Prob. 2QECh. 9.1 - Summarize the roles of the application software...Ch. 9.2 - Prob. 1QECh. 9.2 - Prob. 2QECh. 9.2 - Prob. 4QECh. 9.2 - Prob. 5QECh. 9.2 - Prob. 6QECh. 9.3 - Prob. 1QECh. 9.3 - What is a persistent object?
Ch. 9.3 - Identify some classes as well as some of their...Ch. 9.3 - Prob. 4QECh. 9.4 - Prob. 1QECh. 9.4 - Prob. 2QECh. 9.4 - Prob. 3QECh. 9.4 - Prob. 4QECh. 9.4 - Prob. 5QECh. 9.4 - Prob. 6QECh. 9.5 - Prob. 1QECh. 9.5 - Prob. 2QECh. 9.5 - Prob. 3QECh. 9.5 - Prob. 4QECh. 9.5 - Prob. 5QECh. 9.5 - Prob. 6QECh. 9.5 - Prob. 7QECh. 9.6 - Prob. 1QECh. 9.6 - Give an additional example of a pattern that might...Ch. 9.6 - Prob. 3QECh. 9.6 - How does data mining differ from traditional...Ch. 9.7 - Prob. 1QECh. 9.7 - Prob. 2QECh. 9.7 - Prob. 3QECh. 9.7 - Prob. 4QECh. 9 - Prob. 1CRPCh. 9 - Prob. 2CRPCh. 9 - Prob. 3CRPCh. 9 - Prob. 4CRPCh. 9 - Prob. 5CRPCh. 9 - Prob. 6CRPCh. 9 - Prob. 7CRPCh. 9 - Prob. 8CRPCh. 9 - Prob. 9CRPCh. 9 - Prob. 10CRPCh. 9 - Prob. 11CRPCh. 9 - Prob. 12CRPCh. 9 - Using the commands SELECT, PROJECT, and JOIN,...Ch. 9 - Answer Problem 13 using SQL. PROBLEM 13 13. Using...Ch. 9 - Prob. 15CRPCh. 9 - Prob. 16CRPCh. 9 - Prob. 17CRPCh. 9 - Prob. 18CRPCh. 9 - Prob. 19CRPCh. 9 - Empl Id Name Address SSN Job Id Job Title Skill...Ch. 9 - Empl Id Name Address SSN Job Id Job Title Skill...Ch. 9 - Prob. 22CRPCh. 9 - Prob. 23CRPCh. 9 - Prob. 24CRPCh. 9 - Prob. 25CRPCh. 9 - Write a sequence of instructions (using the...Ch. 9 - Prob. 27CRPCh. 9 - Prob. 28CRPCh. 9 - Prob. 29CRPCh. 9 - Prob. 30CRPCh. 9 - Prob. 31CRPCh. 9 - Prob. 32CRPCh. 9 - Prob. 33CRPCh. 9 - Prob. 34CRPCh. 9 - Prob. 35CRPCh. 9 - Prob. 36CRPCh. 9 - Prob. 37CRPCh. 9 - Prob. 38CRPCh. 9 - Prob. 39CRPCh. 9 - Prob. 40CRPCh. 9 - Prob. 41CRPCh. 9 - Prob. 42CRPCh. 9 - Prob. 43CRPCh. 9 - Prob. 44CRPCh. 9 - Prob. 45CRPCh. 9 - Prob. 46CRPCh. 9 - Prob. 47CRPCh. 9 - Prob. 48CRPCh. 9 - Prob. 49CRPCh. 9 - Prob. 50CRPCh. 9 - Prob. 51CRPCh. 9 - Prob. 52CRPCh. 9 - Prob. 53CRPCh. 9 - Prob. 54CRPCh. 9 - Prob. 55CRPCh. 9 - Prob. 56CRPCh. 9 - Prob. 57CRPCh. 9 - Prob. 58CRPCh. 9 - Prob. 59CRPCh. 9 - Prob. 60CRPCh. 9 - Prob. 61CRPCh. 9 - Prob. 62CRPCh. 9 - Prob. 1SICh. 9 - Prob. 2SICh. 9 - Prob. 3SICh. 9 - Prob. 4SICh. 9 - Prob. 5SICh. 9 - Prob. 6SICh. 9 - Prob. 7SICh. 9 - Prob. 8SICh. 9 - Prob. 9SICh. 9 - Prob. 10SI
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In this exercise you will design and implement a simple encryption program that can either encrypt or decrypt a string of text by following the steps below. Create a dictionary dict that maps each (lower case) character of the basic Latin alphabet to another. Make sure no one letter is mapped to itself. Do not use a simple ordering, such as reversing the alphabet. This will act as your cipher. Your program should be able to ask user for a text and encrypt it. Your program will take each character in the string and swap it with the corresponding character from the cipher, print the encrypted text. Your program should be able to decrypt encrypted text as well. It should perform the opposite operation as the encrypt does. Print the decrypted text. Create a loop that asks if the user would like to encrypt some text, decrypt some cipher text, or exit the program. Perform the operation the user selects, printing the computed text if applicable.arrow_forward1. Given that F is a direct file with n = 2000 records and that the records are stored in orderof their keys. Determine how any record reads it would take to locate a particular record using:a. Sequential search (average case)b. Binary search (worst case)c. (open) hashing with 200 buckets (average case)d. (open) hashing with 400 buckets (average case) 2. Write the declarations to create a data type called: DICTIONARY that represents an openhashing scheme with 20 bucketsarrow_forward3. Suppose you are given a data file called "f" and a queue called "Q". Each record in "f" has "A" or "D" character. Write an algorithm that reads all the records in the file one by one. If record keeps "A" adds this record to "Q". If record keeps "D" delete an element from the "Q". File " and "Q" has the same type. Queue capacity is 20 records.arrow_forward
- Suppose that a shopkeeper decided that customers who come first will be served first. A list of customers must be maintained so that anyone can be accessed randomly. Your program must remember operations performed in the opposite order. The entries should be managed based on the order of arrival and also be deleted when no longer needed. The size of a file is unknown. A list must be maintained so that elements can be added to the beginning or end in O (1).Based on the above scenario you have a list of different data structures, choose appropriate among them and implement using java. It is important that the structure has flexible memory management.arrow_forwardIn the context of the same file management system, it is planned to offer a sorted view of files by name. For that purpose, there is a need for a compare function that takes two strings (file names) and returns: 0: if both files are the same -1: if the first string comes alphabetically before the second string 1: if the first string comes alphabetically after the second string Examples: compare (abc, abc) → 0 compare (abc, de) →-1 compare (xyz, abcde) → 1 i. Design the compare algorithm as described above. Use pseudocode to describe your algorithm.arrow_forwardImplement a blog server in C 1. Implement get of all posts (GET /posts), and individual post (GET /post/1) 2. Implement creation of post (POST /posts). Allow the user to enter their name, but check that they are a valid user in db. Do error checking! The user should not specify the post id; that should come from the database. 3. Write three html files to test this; serve them with the blog server: index.html shows the list of posts with a link to each. post.html shows a post. publish.html allows the creation of a new post. Link these together as a user would expect!arrow_forward
- Assume you have a folders of (images and videos) in your computer which contain some random mix numerical values. Your task is to separate images (e.g odd values) and videos (e.g Even values). So that all the images and videos are stored in separate folders (lists). While separating make sure that any of the folder (lists) should not contain any duplicate file or duplicate value. In this task images and videos odd & even numbers and folder means a single list of mix value. e.g: linkedlists (odd, even). Design a method for above task which will create two separate linked lists and write main method to test your program. FOLDER (VIDEO AND IMAGES:ODD AND EVEN VALUES) LIST 0: [2, 44 , 24 , 82 , 33 , 44 , 55 , 11 , 2 , 44 , 55]: EVEN VALUES_LIST 1: [2, 44 , 24 , 82]: A=2, B=44, C=24, D=82 ODD VALUES:_LIST 2: [33 , 44 , 55 , 11]: A=33, B=45, C=55, D=11arrow_forwardLet's use decorators to build a name directory! You are given some information about people. Each person has a first name, last name, age and sex. Print their names in a specific format sorted by their age in ascending order i.e. the youngest person's name should be printed first. For two people of the same age, print them in the order of their input.For Henry Davids, the output should be: Mr. Henry Davids For Mary George, the output should be: Ms. Mary George Input Format The first line contains the integer , the number of people. lines follow each containing the space separated values of the first name, last name, age and sex, respectively. Constraints Output Format Output names on separate lines in the format described above in ascending order of age. Sample Input 3 Mike Thomson 20 M Robert Bustle 32 M Andria Bustle 30 F Sample Output Mr. Mike Thomson Ms. Andria Bustle Mr. Robert Bustlearrow_forwardI need help creating a Java program that is described in the given image and description below: The attached text file contains record information from records with the following field format:first name,middle name,last name,city nameThe data was badly stored, using the Comma Separated Value (CSV) format, in such a way that the fields do not properly align with that record format. All of the information is there but the record boundaries are mis-aligned. Some, all, or more than a single proper record may exist in as a single record in this file.Example:LarsJame,Thompson,Clifton,JeniferMae,Jones,HenryRick,Luke,SimonsLincoln,Tim,Lee,Huag,BostonSally,Joe,Patton,New YorkHoward,Richard,Larson,Scramento,Samantha,Austin,Henry,St George,GeorgeHenry,Marcus,New Town Your task is to write a program that will read the data from bad files and write new files with the data correctly stored in a new CSV format and in alphabetical order by last name, first name, middle name. The new format is:last…arrow_forward
- Write a program that expands on the program below (i.e. reading data of each record in the file and storing it into data structure). The expansion involves writing all records to a file (use fprintf, call the name of the file csv). The displayed data must be accessed (and thus written) from data structure (i.e. array of structs). The format written to the file should be one line per record, with each field separated by a comma (‘,’) program should then output the number of lines in the file.test the program by creating a text file with at least 10 lines of text (of any composition). Use notepad++ to create the data file. #include<stdio.h>#include<stdlib.h> //Structurestruct Person{ char name[10];int age;float wage; }; //Main int main (int argc, char **argv) { FILE* f; if (argc != 2) { printf("No filename in the argument"); return 1; } f = fopen(argv[1], "r"); if (f == NULL) { printf("The file cannot be opened successfully:…arrow_forwardConsider the adjacency matrix below. Upload a picture (it can be hand drawn) of the adjacency list of the graph. Note: File size must not exceed 1 MB.* B 1 C 1 1 1 1 A, 1.arrow_forwardTask 5 Write a Python program to combine each line from the first file with the corresponding line in the second file and then save it in a 3rd file. Consider, both the files have same number of lines. Assume, each line has a newline(\n) at the end. Example: Input from file 1: Hello Hi Nice Input from file 2: Bad Worse Worst Output in 3rd Flle: Hello Bad Hi Worse Nice Worst Hint(1): Use the write( functionarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education