Project 2.pdf - Project2 Due Oct4by11:59pm Points 20...

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

View Full Document Right Arrow Icon
Project 2 Due Oct 4 by 11:59pm Points 20 Submitting a file upload File Types zip Available Aug 30 at 12am ­ Dec 13 at 11:59pm 4 months Submit Assignment Directions: PLEASE NOTE: You may not use any STL collection classes when implementing this programming project. You must use the code discussed in class. Please choose the code download which matches your development environment ( ListStackQueue Code For VS2012 ( ) ListStackQueue Code For XCode 7 ( ) ). You need only do two of the following three projects. However, you must complete the List project. However, I will give you extra credit for completing all three. If I don't specifically mention O( n ) , then you are free to implement the operation as quickly or as slowly as you like. However, if I do mention O( n ) , then I would like you to try to get your code running with a certain speed in mind. It should be doable... Project 2A : Working With Singly­Linked Lists (REQUIRED) Complete the following exercises using the cs20::List class presented in class. 1. Without using a ListIterator, define and implement a new operation calledinsert_back which takes a single template Object and inserts the Object at the end of the list. A brute force version of this method would walk down the list to find the end, and therefore would run in linear time, O(n) , for a list with n elements. Think carefully about the running time of this operation, T(n) . Without changing the meaning of this operation or any other, modify the representation of a List and alter whatever methods are necessary to make insert_back run in constant time: O(1) . HINT: Your List class will need to continually maintain a pointer to the last (tail) ListNode on the List, and all of List's methods will have to ensure that this member stays current even as the list changes. This new operation of the List class should have the signature: void insert_back( const Object& data ); TESTING HINT: Run the methods: insert( 3 ); insert( 2 ); insert( 1 ); Print the list. What should it look like?
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern