-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestSList.C
More file actions
executable file
·49 lines (46 loc) · 1.02 KB
/
TestSList.C
File metadata and controls
executable file
·49 lines (46 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include "ListUtils.H"
using namespace std;
int main()
{
SList<int> Lista;
//insertamos elementos
for(int i = 0; i < 10; i++)
{
Lista.insertFirst(i);
}
//Utilizamos el iterador
cout<<"Valores de la lista"<<endl;
for(SList<int>::Iterator it(Lista);it.hasCurrent();it.next())
{
cout<<it.getCurrent()->getData()<<" ";
}
cout<<endl;
cout<<"Valores menor de la lista"<<endl;
cout<<searchMin(Lista)<<endl;
//simpleSort(Lista);
quickSort(Lista);
cout<<"Valores ordenados de la lista"<<endl;
for(SList<int>::Iterator it(Lista);it.hasCurrent();it.next())
{
cout<<it.getCurrent()->getData()<<" ";
}
cout<<endl;
SList<int> lista1;
//probamos el intercambio entre listas
lista1.swap(Lista);
//probamos la asignacion estre listas
Lista = lista1;
if(lista1 == Lista)
{
cout<<"Las listas son Iguales"<<endl;
}
//Probamos los [] sobre la lista
//OJO esta operacion hace muy lento el acceso a la misma
for(int i = 0;i < Lista.getSize();i++)
{
cout<<Lista[i]<<" ";
}
cout<<endl;
return 0;
}