


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Information about the first homework assignment for csce 310 data structures & algorithms course at the university of nebraska-lincoln, due on september 2, 2004. The assignment includes a c++ programming problem to create a program named printwithtabs that reads an input file, converts commas to tab characters, deletes semicolons, and prints the modified contents to standard output. Additionally, students are required to create a makefile and write a design and analysis document. The document also includes a brief explanation of binary search and an example of its implementation, along with an inelegant code attempt and questions related to its output and improvements.
Typology: Assignments
1 / 4
This page cannot be seen from the preview
Don't miss anything!



(1) 60 points: This is a “simple” C++ programming problem to help familiarize you with the Linux development environment and to refresh your programming skills. The requirements are simple: a. Your C++ executable program will be named PrintWithTabs. b. It will accept one input parameter on the command line, which will be the name of the ASCII input file. That is, your program will be execute with the command: PrintWithTabs inputFile c. The program will read from the input file, convert all commas to tab characters, delete all semicolons, and print the modified contents to standard output (stdout). For example, a sample line from an inputFile which reads Line1,of,input,data; Line2,forecast,input,data; Line3,input,,data; Line4,,,data; will be output as Line1 of input data Line2 forecast input data Line3 input data Line4 data d. The coding standard must be followed. e. Create and turn in a Makefile that will build your executable from your source file(s).
You may download a test input file from the course Web page. Its URL is http://cse.unl.edu/~goddard/Courses/CSCE310J/Assignments/ForecastDataWithNames.csv
The problem will be scored at follows: Program correctness 30% (18 pts) Quality of design/readability 25% (15 pts) In-line documentation/coding standard 25% (15 pts) Design and analysis document 15% (9 pts) Thoroughness of test cases 05% (3 pts)
The design and analysis document should describe how your program works, what design choices (if any) were made and why, and any known defects. You may also discuss enhancements you think should be made, but were beyond the scope of the assignment (i.e., in violation of the specifications).
(2) 20 points:The following rather inelegant code is an attempt at the implementation of a binary search of an array.
“A brief description of a binary search is as follows: The binary search algorithm can only be applied if the data are sorted. You can exploit the knowledge that they are sorted to speed up the search. The idea is analogous to the way people look up an entry in a dictionary or telephone book. You don't start at page 1 and read every entry! Instead, you turn to a page somewhere about where you expect the item to be. If you are lucky you find the item straight away. If not, you know which part of the book will contain the item (if it is there), and repeat the process with just that part of the book. If you always split the data in half and check the middle item, you halve the number of remaining items to check each time. This is much better than linear search, where each unsuccessful comparison eliminates just one item.”*
(3) 20 points The following implementation is working code. However, the poor choice of variable names and the complete lack of comments as well as the nondescript prompts have rendered this code fairly unreadable.
a) Describe, in detail, what this code does. b) Rename the variables to more intuitive names. c) Change the words in the messages to properly prompt for what is needed. d) Add comments to briefly explain what is occuring. e) Submit working code with all modifications made.
#include
bool C(BAR b, int n, int d){ bool h = false; for (int s = 0; s < n; s++) for (int q = 0; q < n; q++)if (b[s][q] == d)h = true; return h; }