PDA

View Full Version : Ordinamento Lista


MrGhoost
04-05-2009, 15:58
Ragazzi qualcuno sarebbe cosi gentile da aiutarmi a ordinare un Lista con puntatori....sono 3 giorni che non riesco :D :D
il linguaggio in uso e il c++
grazie

||ElChE||88
04-05-2009, 16:00
Se non posti un po' di codice come facciamo a sapere com'č costruita la lista, in base a cosa devi ordinare, etc.?

MrGhoost
04-05-2009, 16:16
giusto giusto hai ragione! devo ordinalral in base al nominativo :D

#ifndef LIST_H
#define LIST_H

typedef struct _NODE {
const char* name;
int phone;
~_NODE () { delete[] name; }
struct _NODE* next;
} NODE;

class List {

public:
List();
~List();

bool empty();
void push(const char* name, int phone);
bool pop();
NODE* top() {
return first;
};
void append(const char* name, int phone);
void stampa();
bool estrai_coda();
NODE* ultimo(){
return last;
};
NODE* find(const char* name);
bool elimina(const char* name);

private:
NODE *first, *last;
NODE* createNode(const char* name, int phone);
};

#endif //LIST_H

||ElChE||88
04-05-2009, 16:23
Radix sort (http://en.wikipedia.org/wiki/Radix_sort)...

MrGhoost
04-05-2009, 16:29
e cioč? qualcuno mi puo aiutare grazie

cionci
05-05-2009, 07:19
Thread chiuso
|
V
http://www.hwupgrade.it/forum/showthread.php?t=1649196