Singly-Linked Lists insert_back and isIncreasing
Posted
by
rezivor
on Stack Overflow
See other posts from Stack Overflow
or by rezivor
Published on 2013-10-21T21:50:58Z
Indexed on
2013/10/21
21:53 UTC
Read the original article
Hit count: 146
c++
|singly-linked-list
I just finished writing a program that I can add, remove or print objects to a list, but I am having difficulty implementing two more functions
that is insert_back, which inserts a value to the end of a list. Also,I have to modify the representation of a List and alter whatever methods are necessary to make insert_back run in constant time: O(1).
This new operation should have the signature:
void List::insert_back( const Object& data );
Also, isIncreasing, For example, for a list containing head-() (11) (8) (15) (3), isIncreasing() should return false. However, it would return true when working on a list containing head- () (7) (9) (15).
This new operation should have the signature:
bool List::isIncreasing() const;
Thank you
© Stack Overflow or respective owner