-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestDList.C
More file actions
executable file
·52 lines (48 loc) · 1.04 KB
/
TestDList.C
File metadata and controls
executable file
·52 lines (48 loc) · 1.04 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
50
51
52
#include <iostream>
#include "ListUtils.H"
using namespace std;
int main()
{
DList<int> Lista;
//insertamos elementos
for(int i = 0; i < 10; i++)
{
Lista.insertFirst(i);
}
//Utilizamos el iterador
cout<<"Valores lista"<<endl;
for(DList<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);
//mergeSort(Lista);
sort(Lista);
cout<<"Valores lista ordenada"<<endl;
for(DList<int>::Iterator it(Lista);it.hasCurrent();it.next())
{
cout<<it.getCurrent()->getData()<<" ";
}
cout<<endl;
DList<int> lista2;
//probamos el intercambio entre listas
lista2.swap(Lista);
//probamos la asignacion estre listas
Lista = lista2;
if(lista2 == Lista)
{
cout<<"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;
}