From 58699b7d2e442e4161818b727ef95efe0f8da539 Mon Sep 17 00:00:00 2001 From: Alessandro Ferro <49845537+xfarrow@users.noreply.github.com> Date: Wed, 2 Jun 2021 11:50:40 +0200 Subject: [PATCH] Library 5 bugfix --- librerie/exercise5/matrix/csr/matrixcsr.cpp | 61 +++++++++++---------- librerie/exercise5/zmytest/test.cpp | 22 ++------ 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/librerie/exercise5/matrix/csr/matrixcsr.cpp b/librerie/exercise5/matrix/csr/matrixcsr.cpp index 2848d3e..ea8cca3 100755 --- a/librerie/exercise5/matrix/csr/matrixcsr.cpp +++ b/librerie/exercise5/matrix/csr/matrixcsr.cpp @@ -140,28 +140,32 @@ void MatrixCSR::ColumnResize(const ulong& new_column_size){ Clear(); } else if(new_column_size < columns){ - Node** last; - Node** last_not_deleted; + Node** prev; Node* toDelete; + Node** toModify; for(ulong i=0 ; ivalue).second < new_column_size){ - last_not_deleted = &( (*(*ptr)).next ); + prev = &( (*(*ptr)).next ); + ptr = &( (*(*ptr)).next); }else{ + std::cout<<"\n\nSto cancellando "<<((*ptr)->value).first<<"\n\n"; toDelete = *ptr; + toModify = &( (*(*ptr)).next ); *ptr = (*(*ptr)).next; delete toDelete; --size; + //debug(); + for(ulong j=i+1 ; j::FoldPostOrder(const typename FoldableContainer::Fold template void MatrixCSR::debug(){ std::cout<value).first<<"|"<< (tmp->value).second; - std::cout<next); - - std::cout<next; - } - - std::cout << "R VECTOR:" << '\n'; - for(ulong i=0; ivalue).first<<"|"<< (tmp->value).second; + // std::cout<next); + // + // std::cout<next; + // } + // + // std::cout << "R VECTOR:" << '\n'; + // for(ulong i=0; i