mirror of https://github.com/xfarrow/lasd.git
Library 4
This commit is contained in:
parent
584f7c3003
commit
5406753bbe
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -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 \
|
||||||
|
|
|
@ -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]<<" ";
|
||||||
|
|
Loading…
Reference in New Issue