HW4_time_complexity.pdf

# HW4_time_complexity.pdf - COSC2320 Data Structures and...

This preview shows pages 1–2. Sign up to view the full content.

COSC2320: Data Structures and Algorithms HW4: Time Complexity of Union and Intersection of Sets 1 Introduction The purpose of this homework is to estimate time complexity T ( n ) (# of operations, not clock time) to compute intersection and union of sets, counting operations. In our case the sets contain words. Since words can be repeated in input files (i.e. bags as input) your program should count the number of occurrences (i.e. sets as output). You will write a C++ program to estimate time complexity of union and intersection of two sets. You are expected to count number of computations to estimate time T ( n ) , find the big O () function (with its two constants) and display numbers in tabular form. 2 Input The input is one script file, as in previous homeworks. The script file will ask you to read 2 or more input files into doubly linked lists and operate on them. In order to simplify the problem, the formatting of the original files will be discarded. Additional aspects about input: All uppercase characters must be changed to lower case. The input files will contain no punctuation symbols. Another important detail is that input files might be empty, since the empty set ( ) is a valid set. union(L1,L2,L3) will find the union of sets L1 and L2 and store the result in L3. intersection(L1,L2,L3) will find the intersection of sets L1 and L2 and store the result in L3. The script will ask you to perform one operation between sets (either union or intersection). The time required for this operation will be recorded. 3 Program and output specification The main program should be called ”time”. You can use the Command Line Parser that is provided in the TA’s homepage.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern