EBK DATA STRUCTURES AND ALGORITHMS IN C
4th Edition
ISBN: 9781285415017
Author: DROZDEK
Publisher: YUZU
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Can you fix the code of the completion time based on the last execution of each process in the gantt chart and the output of the completion time must be the same as the image below?Code:
#include <iostream>#include <queue>#include <string>#include <vector>
struct Process { int processId; int burstTime; int priority;};
void print_gantt_chart(const std::vector<std::pair<int, int>>& gantt_chart) { std::cout << "Gantt Chart:" << std::endl; std::cout << "----------------------------------------------------------------------------" << std::endl; std::cout << "| ";
for (const auto& process : gantt_chart) { std::cout << "P" << process.first << " | "; }
std::cout << std::endl; std::cout << "----------------------------------------------------------------------------" << std::endl; std::cout << "0 ";
int currentTime = 0; for (const…
An “inverted file” is a critical data structure for implementing applications like the index of a book, or a web search engine. Given a document D (which can be viewed as an unordered, numbered list of words), an inverted file is an ordered list of words L such that for each word W in L, we store the indices of the places in D where W appears. Write a C# program (from scratch please, written by yourself (ask instructor if you are stuck), not borrowed from any other sources) that reads in a list of words separated by spaces from a text file, then uses an efficient O(N) algorithm to create the inverted file index (hint: consider the topic of this chapter, consider using a Dictionary/hashtable to help you), and writes this index out to another file or prints it to the screen. Each line of the output file should start with the next word (the words should be listed in alphabetical order, and this sorting does not have to be part of the O(N) runtime complexity, e.g. you can use regular…
sing good OOP, write a C++ program that will read an input file to manage a list of students waiting to register for a ourse using a linked list.
The input file name is WaitList.txt and is located in the current directory of the project.
The file layout is as follows:
action student name
Actions are defined as follows:
1 - add student name to the end of the linked list2 - add student name to the beginning of the linked list3 - delete the student at the beginning of the linked list4 - delete the student at the end of the linked list
Actions #1 and #2 require student names. Actions #3 and #4 do not.
For example, if the input file contents contained:
1 Sally Sue Student1 Peter Pupil1 Sam Scholar42 Terri Tutor1 Abby Achiever32 Bill Brain
The program would display the wait list as follows:
The Wait List:
1. Bill Brain2. Sally Sue Student3. Peter Pupil4. Abby Achiever
End of List.
Then the program will prompt the user if they wish to delete a student by name. If…
Chapter 9 Solutions
EBK DATA STRUCTURES AND ALGORITHMS IN C
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
- A C++ program that reads the records from a golf.txt file and displays them. Quick and dirty table without a header The golf.txt file has the names like this: "Arnold Palmer,74,Tiger Woods,69,Sam Snead,89,Micky Mouse,113," The output shows like this: Player Name: Arnold Palmer Score: 74Player Name: Tiger Woods Score: 69Player Name: Sam Snead Score: 89Player Name: Micky Mouse Score: 113arrow_forwardYour submitted programs should include: 1) Executable file 2) Source code The programming language: C++ 4、Dancing Partner Matching(Queue)[Solution introduction: the second video in 3.6] [Problem description] In a ball, when gentlemen and ladies come, they form a queue of gentlemen and a queue of ladies, respectively. When the ball starts, the gentlemen and ladies who come first should get partners first. A gentleman should be matched with a lady. Similarly, a lady can only match with a gentleman. Write programs to simulate the process of dancing partner matching. The maximal number of coming gentlemen or ladies is 30. [Basic requirements] 1) Use queues to solve this problem. [Example]Problem: Match coming gentlemen and ladies. What you need to show in the terminal(the back part is outputted by you and the blue part is inputted by the user, i.e., teacher): Please input coming dancers: Mark, male, 19 Alice, female, 21 Jenny, female, 23 Bob, male, 20 Andrew,male, 19 Julian,…arrow_forwardWrite a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements in c++ : Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use the find() function to find the index of a comma in each…arrow_forward
- I need help on this home work: Using OOP, write a C++ program that will read an input file to manage a list of students waiting to register for a course using a linked list.The input file name is WaitList.txt and is located in the current directory of the project. Waitlist.txt content: 1 Samuel Stone1 Brett Bacher2 Emily Evans44331 Zachary Zillings2 Carson Cummings1 Penny Plumber31 Tammy Thompson The file layout is as follows:action student nameActions are defined as follows:1 - add student name to the end of the linked list2 - add student name to the beginning of the linked list3 - delete the student at the beginning of the linked list4 - delete the student at the end of the linked listActions #1 and #2 require student names. Actions #3 and #4 do not.For example, if the input file contents contained: 1 Sally Sue Student1 Peter Pupil1 Sam Scholar42 Terri Flowers1 Abby Achiever32 Bill Brain The program would display the wait list as follows: The…arrow_forward4. Write a Program to create Queue of Patients waiting to see the Physician in a clinic. Insert Patient details one by one into the Patient Queue in its appropriate position based on the Age, irrespective of their arrival time. Patients should be allowed in the order from the oldest to the youngest.arrow_forwardA java file that reads a text file, in.txt, that contains a list of positive integers a positive integer) separated by spaces and/or line breaks. After reading the integers, the program must recursively figure out if the list of integers includes two equal integers. If the list includes two equal integers, the program prints out Yes. Otherwise, the program prints out No. Assume that in.txt contains at least 2 integers. It is important that your program be named Two and that the input file is named in.txt.arrow_forward
- write a python code named get_total_cases() takes the a 2D-list (similar to database) and an integer x from this set {0, 1, 2} as input parameters. Here, 0 represents Case_Reported_Date, 1 represents Age_Group and 2 represents Client_Gender (these are the fields on the header row, the integer value represents the index of each of these fields on that row). This function computes the total number of reported cases for each instance of x in the text file, and it stores this information in a dictionary in this form {an_instance_of_x : total_case}. Finally, it returns the dictionary and the total number of all reported cases saved in this dictionary. (Suppose we want to know the total number of cases reported on each date, so use x = 0.) >>> result, total_cases = get_total_cases(database, 0) >>> display_dict(result) 2021-05-19: 8 2021-05-20: 2 2021-05-21: 1 2021-05-22: 1 >>> print(total_cases)arrow_forwardDevelop a program in Java to maintain a list of homework assignments. When an assignment is assigned, add it to the list, and when it is completed, remove it. You should keep track of the due date. Your program should provide the following services: 1. Add a new assignment. 2. Remove an assignment. 3. Provide a list of the assignments in the order they were assigned. 4. Find the assignment(s) with the earliest due date.arrow_forwardImplement in C Programming 9.10.1: LAB: Movie show time display Write a program that reads movie data from a CSV (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the CSV file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator ('|') in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the CSV file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Hints: Use…arrow_forward
- Write a C program to keep records and perform statistical analysis for a class of n students. The information of each student contains Name, CAT-1 score, CAT-2 score and total score. The program will prompt the user to choose the operation of records from a menu as shown below1. Add student records 2. Delete student records 3. Update student records 4. View all student records Implement a Menu Driven Program for the above specification using functions only.arrow_forwardWrite a program to process stock data. The stock data should be read from a text file containing the following data: stock code, stock name, amount invested (XXX.XX), shares held, and current price. Sue the internet or your local paper to gather data on at least 20 stocks. As each stock is read, insert it into a doubly linked list. The first logical list should be ordered on the stock code. The second should be ordered on the gain or loss for the stock. Gain or loss is calculated as the current value of the stock (shares held times current price) minus the amount invested. Include at least one loss in your test data. After building the lists, display a menu that allows the user to display either logical list forward or backward (a total of four options). Each display should contain an appropriate heading and column caption. Run your program and submit a list of your input data and a print out of each display option.arrow_forwardWrite a program that reads movie data from a csv (comma separated values) file and output the data in a formatted table. The program first reads the name of the CSV file from the user. The program then reads the csv file and outputs the contents according to the following requirements: Each row contains the title, rating, and all showtimes of a unique movie. A space is placed before and after each vertical separator (|) in each row. Column 1 displays the movie titles and is left justified with a minimum of 44 characters. If the movie title has more than 44 characters, output the first 44 characters only. Column 2 displays the movie ratings and is right justified with a minimum of 5 characters. Column 3 displays all the showtimes of the same movie, separated by a space. Each row of the csv file contains the showtime, title, and rating of a movie. Assume data of the same movie are grouped in consecutive rows. Ex: If the input of the program is: movies.csv and the contents of movies.csv…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,