logo

CISP400 Object Oriented Programming with C++

12 Pages2105 Words260 Views
   

Object Oriented Programming with C++ (CISP400)

   

Added on  2019-10-09

CISP400 Object Oriented Programming with C++

   

Object Oriented Programming with C++ (CISP400)

   Added on 2019-10-09

ShareRelated Documents
You can choose to submit either A7 (worth 150 points), AD7 (worth 180), or both (worth 180) for 7th assignment you will get a score for this assignment either 150 points base or 180 points base. Grading Criteria:1.If the submitted program cannot be compiled or run on a Microsoft visual studio 2013 C++ compiler, the assignment will not get any credit.2.If the file name does not follow the naming instruction as stated in syllabus, the assignment will get 5 to 15 points deduction. 3.If the header section of the submitted file does not include personal information and purpose of the file, the assignment will get 5 to 30 points deduction.4.Late assignments will not get any credit for the assignment. 5.A submission does not follow the instructions of the assignment will get little credit.6.A portion of the assignment is not finished or incomplete will get little or no credit.7.Submit an assignment to a wrong drop box. The wrong drop box one will not get any credit.8.If use A for AD or AD for A assignments in the file name, the student will not get any credit for the assignments. 9.If the submitted file(s) cannot be opened by the instructor’s software (WinZip, Visual Studio, or text editor) the assignment will have little credit.10.If the submission file does not include all necessary programming files to run the program, the program will get little credit.11.If the program does not separate into several files (driver, header file, implementation file, etc.) as describe in the assignment, the program will get little credit.Page 1 of 12CISP400V9A7
CISP400 Object Oriented Programming with C++_1
12.If the displaying result of the program is not exactly match with the graphic in the assignment description or the displaying result of the executable file which comes with the assignment, the assignment will get little credit. 13.If the program does not have enough detail documentation in the programming area the program will get 5 to 30 points deduction.14.If the program includes some unrelated documentation the program will get some points deduction.A7(Quicksort) The recursive sorting technique called quicksort uses the following basic algorithm for a one-dimensional vector of values:a) Partitioning Step: Take the first element of the unsorted vector and determine its final location in the sorted vector (i.e., all values to the left of the element in the vector are less than the element’s value, and all values to the right of the element in the vector are greater than the element’s value—we show how to do this below). We now have one value in its proper location and two unsorted subvectors.b) Recursion Step: Perform the Partitioning Step on each unsorted subvector. Each time the Partitioning Step is performed on a subvector, another value is placed in its final location of the sorted vector, and two unsorted subvectors are created. When a subvector consists of one element, that element’s value is in its final location (because a one-element vector is already sorted).The basic algorithm seems simple enough, but how do we determine the final position of the firstelement value of each subvector? As an example, consider the following set of values (the value in bold is for the partitioning element—it will be placed in its final location in the sorted vector):37 2 6 4 89 8 10 12 68 45Page 2 of 12CISP400V9A7
CISP400 Object Oriented Programming with C++_2
Starting from the rightmost element of the vector, compare each element value with 37 until an element value less than 37 is found; then swap 37 and that element’s value. The first element value less than 37 is 12, so 37 and 12 are swapped. The new vector is12 2 6 4 89 8 10 37 68 45Element value 12 is in italics to indicate that it was just swapped with 37. Starting from the left of the vector, but beginning with the element value after 12, compare each element value with 37until an element value greater than 37 is found— then swap 37 and that element value. The first element value greater than 37 is 89, so 37 and 89 are swapped. The new vector is12 2 6 4 37 8 10 89 68 45Starting from the right, but beginning with the element value before 89, compare each element value with 37 until an element value less than 37 is found—then swap 37 and that element value.The first element value less than 37 is 10, so 37 and 10 are swapped. The new vector is12 2 6 4 10 8 37 89 68 45Starting from the left, but beginning with the element value after 10, compare each element valuewith 37 until an element value greater than 37 is found—then swap 37 and that element value. There are no more element values greater than 37, so when we compare 37 with itself, we know that 37 has been placed in its final location of the sorted vector. Every value to the left of 37 is smaller than it, and every value to the right of 37 is larger than it. Once the partition has been applied on the previous vector, there are two unsorted subvectors. The subvector with values less than 37 contains 12, 2, 6, 4, 10 and 8. The subvector with values greater than 37 contains 89, 68 and 45. The sort continues recursively, with both subvectors being partitioned in the same manner as the original vector.Based on the preceding discussion, write a recursive function, quickSortHelper, to sort ten one-dimensional integer vectors. The function should receive as arguments a starting index and an ending index on the original vector being sorted. Please create ten vectors with random size from 0 ~20 elements and randomly choose the size of the vector numbers from 0~100. Put the numbers in the vectors and use quick sort to sort them.Page 3 of 12CISP400V9A7
CISP400 Object Oriented Programming with C++_3
This assignment comes with a CISP400V9A7.zip file. It includes CISP400V9A7.exe file. The CISP400V9A7.exe file is an executable file. You can double click the file to get to the expectingresult of this assignment. The following are some of the displays of the expecting results.Please be aware the vector size is randomlychoose from 0 ~ 20 and the created sized for a vector is listed inside a pair of parentheses (“ ( )”). Page 4 of 12CISP400V9A7
CISP400 Object Oriented Programming with C++_4

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Object Oriented Programming with C++ CISP400
|10
|3182
|386

Assignment on CISP400 Object Oriented Programming with C++
|6
|2031
|364

Assignment CISP400 Object Oriented Programming with C++
|11
|3830
|198

CISP400 Object Oriented Programming with C++ Assignment
|10
|2009
|76

CISP400 Assignment Object Oriented Programming with C++
|11
|3728
|429