[Solved] CS2134-Homework 6- Draw the conceptual representation for our implementation of a link list

$25

File Name: CS2134-Homework_6-_Draw_the_conceptual_representation_for_our_implementation_of_a_link_list.zip
File Size: 857.22 KB

SKU: [Solved] CS2134-Homework 6- Draw the conceptual representation for our implementation of a link list Category: Tag:
5/5 - (1 vote)

HOMEWORK 6

Written Part:1. Draw the conceptual representation for our implementation of a link list (include the header) containing a single item A.2. For each of the following, determine if the code compiles.vector A = {1,2,3,4,5}; vector::iterator vItr1; vector::iterator vItr2; list C = {1, 2,3,4,5}; list::iterator lItr1; list::iterator lItr2;(a)vItr1 = A.begin( ); vItr2 = A.end( );cout << vItr1 + (vItr1 + vItr2)/2;(b) lItr1 = C.begin( ); lItr2 = find(C.begin(), C.end(), 3); if ( lItr1 < lItr2 ) cout << ” 2 is not the first item “;3. For each of the following, determine if the iterator is valid.vector A = {1,2,3,4,5}; vector B; vector::iterator vItr; list C = {1, 2,3,4,5}; list D; list::iterator lItr;(a) B = A; vItr = B.begin();B.erase(B.begin()+1);(b) B = A;vItr = B.begin()+2;B.erase(B.begin()+1);(c) D = C; lItr = C.begin();C.erase(++C.begin());(d) D = C;lItr = ++D.begin();++lItrD.erase(++D.begin());4. Which of the following code snippets are valid? If the code snippet is invalid, state why.(a) list l; list::iterator lIter; l.push_back(200); lIter = l.begin(); for (int i = 1; i < 100; ++i)l.push_front(i);for (int i = 1; i < 100; ++i)l.push_back(-i);cout << *lIter << endl;(b) list l; list::iterator lIter1; list::iterator lIter2; list::iterator mid;for (int i = 0; i < 100; ++i)l.push_back(i); lIter1 = l.begin(); lIter2 = l.end(); mid = lIter1 + (lIter2 lIter1)/2; cout << *mid << endl;(c) vector v; vector::iterator vIter1; vector::iterator vIter2; vector::iterator mid;for (int i = 0; i < 100; ++i)v.push_back(i);vIter1 = v.begin(); vIter2 = v.end(); mid = vIter1 + (vIter2 vIter1)/2; cout << *mid <next; while ( prev != nullptr ){ if ( prev->next->data == x ) erase_after( iterator(prev) );else prev = prev->next;}}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS2134-Homework 6- Draw the conceptual representation for our implementation of a link list
$25