Library 4

This commit is contained in:
Alessandro Ferro 2021-05-21 09:34:15 +02:00
parent 584f7c3003
commit 5406753bbe
25 changed files with 6 additions and 6 deletions

View File

@ -324,7 +324,7 @@ typename BST<Data>::NodeLnk* const* BST<Data>::FindPointerToPredecessor(struct B
Note: I return a ** instead of *& because we deferenciate a variable that might Note: I return a ** instead of *& because we deferenciate a variable that might
contain nullptr (lastRight) that, without proper handling, would result to contain nullptr (candidate) that, without proper handling, would result to
an invalid read. I decided to keep it simpler to understand. an invalid read. I decided to keep it simpler to understand.
*/ */

View File

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
g++-10 -o main \ g++ -O3 -o main \
zlasdtest/exercise1/simpletest.cpp zlasdtest/exercise1/fulltest.cpp \ zlasdtest/exercise1/simpletest.cpp zlasdtest/exercise1/fulltest.cpp \
zlasdtest/exercise2/simpletest.cpp zlasdtest/exercise2/fulltest.cpp \ zlasdtest/exercise2/simpletest.cpp zlasdtest/exercise2/fulltest.cpp \
zlasdtest/exercise3/simpletest.cpp zlasdtest/exercise3/fulltest.cpp \ zlasdtest/exercise3/simpletest.cpp zlasdtest/exercise3/fulltest.cpp \

0
librerie/exercise4/zlasdtest/binarytree/binarytree.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/bst/bst.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/container/container.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/container/container.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise1/fulltest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise1/simpletest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise1/test.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise2/fulltest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise2/simpletest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise2/test.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise3/fulltest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise3/simpletest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise3/test.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise4/fulltest.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/exercise4/test.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/iterator/iterator.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/list/list.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/queue/queue.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/stack/stack.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/test.cpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/test.hpp Executable file → Normal file
View File

0
librerie/exercise4/zlasdtest/vector/vector.hpp Executable file → Normal file
View File

View File

@ -611,7 +611,7 @@ bool NodeOperations(T& currentNode){
do{ do{
cout<<" *** Element in the current node: "<<currentNode.Element()<<" ***"<<endl; cout<<" *** Element in the current node: "<<currentNode.Element()<<" ***"<<endl;
cout<<" 1. Go left"<<endl; cout<<" 1. Go left"<<endl;
cout<<" 2. Go Right"<<endl; cout<<" 2. Go right"<<endl;
cout<<" 3. Is this a leaf?"<<endl; cout<<" 3. Is this a leaf?"<<endl;
cout<<" 4. Go up"<<endl; cout<<" 4. Go up"<<endl;
cout<<" 5. Go to menu"<<endl; cout<<" 5. Go to menu"<<endl;
@ -659,7 +659,7 @@ BST<int> GenerateIntegerBST(BST<int>& bst){
default_random_engine gen(random_device{}()); default_random_engine gen(random_device{}());
uniform_int_distribution<int> dist(0,1000); uniform_int_distribution<int> dist(0,1000);
cout<<"\n\nElements in the binary tree (in order of insertion):\n"; cout<<"\n\nElements in the binary search tree (in order of insertion):\n";
for(ulong i=0 ; i<dim ; ++i){ for(ulong i=0 ; i<dim ; ++i){
tmp[i] = dist(gen); tmp[i] = dist(gen);
cout<<tmp[i]<<" "; cout<<tmp[i]<<" ";
@ -677,7 +677,7 @@ BST<float> GenerateFloatBST(BST<float>& bst){
default_random_engine gen(random_device{}()); default_random_engine gen(random_device{}());
uniform_real_distribution<double> distr(0,5); uniform_real_distribution<double> distr(0,5);
cout<<"\n\nElements in the binary tree (in breadth order):\n"; cout<<"\n\nElements in the binary search tree (in order of insertion):\n";
for(unsigned long i = 0; i < dim; ++i){ for(unsigned long i = 0; i < dim; ++i){
tmp[i] = (round(distr(gen)*10000))/100; tmp[i] = (round(distr(gen)*10000))/100;
cout<<tmp[i]<<" "; cout<<tmp[i]<<" ";
@ -695,7 +695,7 @@ BST<string> GenerateStringsBST(BST<string>& bst){
default_random_engine gen(random_device{}()); default_random_engine gen(random_device{}());
uniform_int_distribution<int> dist(1,5); uniform_int_distribution<int> dist(1,5);
cout<<"\n\nElements in the tree (in breadth order):\n"; cout<<"\n\nElements in the binary search tree (in order of insertion):\n";
for(ulong i = 0; i < dim; ++i){ for(ulong i = 0; i < dim; ++i){
tmp[i] = generateRandomString(dist(gen)); tmp[i] = generateRandomString(dist(gen));
cout<<tmp[i]<<" "; cout<<tmp[i]<<" ";