Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Algoritmi e strutture dati > [PROGETTO] "Mappe 2" Thread Rating: 1 votes, 5.00 average.
Pages (17): « 1 2 3 [4] 5 6 7 8 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Simeon
:D

User info:
Registered: Aug 2004
Posts: 984 (0.13 al dì)
Location: Milano
Corso: Informatica
Anno: IT IS OVER!
Time Online: 14 Days, 19:29:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ragazzi, sto andando nel pallone piu completo, naturalmente parlo della nota 3.

Voglio dire, io apro il mio file primo.txt e ho la mia bella lista di valori "-1 -3 2 -2 2 1 0 2 -2 3 2 -1 0 -2 1 -2"

E dico : a = x mod m e b = y mod n. Val (x,y) = v[a+mb]... Non riesco a capire quali valori dare a (x,y), forse tutti i punti da (0,0) a (m,n) ?

Se qualcuno fa un esempio pratico lo ringrazio dal profondo del cuore.

Nel "secondo.txt" per esempio c'e' un solo valore: -1. Quindi abbiamo un solo punto. Nella mia testa io porrei x,y=(1,1), che sarebbe l'unico punto possibile. Quindi uno fa a = 1 mod -1 e b = 1 mod -1, e il valore si trova a v[a+mb] cioe v[0]. Quindi val(1,1) = -1.

09-02-2006 11:04
Click Here to See the Profile for Simeon Click here to Send Simeon a Private Message Find more posts by Simeon Add Simeon to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Polsy
.arcimaestro.

User info:
Registered: Dec 2003
Posts: 477 (0.06 al dì)
Location:
Corso: Info phd
Anno:
Time Online: 17 Days, 17:11:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by MaurizioL
C'è una funzione apposta chiamata realloc;

if usi linux:
man realloc (per leggere la guida)

else if usi windows{
cerca su internet || scarica il progetto di ornati e guarda lì
}

else{
Usa il mio codice:

char* get_string(char end){
char input;
int len=0;
int mem=100;
char *string=(char*)malloc(mem*sizeof(char));
while((input=getchar())!=end){
if(len>mem-1){
mem*=2;
string=(char*)realloc(string,mem);
}
string[len++]=input;
}
string[len]=0x0;
return string;
}

}


quanto sei nerd :asd:

09-02-2006 11:12
Click Here to See the Profile for Polsy Click here to Send Polsy a Private Message Visit Polsy's homepage! Find more posts by Polsy Add Polsy to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
MaurizioL
.simpatizzante.

User info:
Registered: Feb 2006
Posts: 17 (0.00 al dì)
Location: Omegna
Corso: Informatica
Anno: 2
Time Online: 3:44:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Polsy
quanto sei nerd :asd:


Io nerd?

Leggi i sorgenti di Ornati e poi mi dici

http://www.dsy.it/forum/showthread....&threadid=24001

:-D

__________________
Maurizio Lombardi
Linux 2.6.14.2
-----------------------

09-02-2006 11:16
Click Here to See the Profile for MaurizioL Click here to Send MaurizioL a Private Message Find more posts by MaurizioL Add MaurizioL to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Nosferatu
.simpatizzante.

User info:
Registered: Oct 2004
Posts: 10 (0.00 al dì)
Location:
Corso: Informatica
Anno: 1
Time Online: 12:10:30 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Una cosa ma il carattere end che gli passi come parametro, che carattere è

09-02-2006 11:19
Click Here to See the Profile for Nosferatu Click here to Send Nosferatu a Private Message Find more posts by Nosferatu Add Nosferatu to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Simeon
:D

User info:
Registered: Aug 2004
Posts: 984 (0.13 al dì)
Location: Milano
Corso: Informatica
Anno: IT IS OVER!
Time Online: 14 Days, 19:29:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Che poi scusate, quando si memorizzano i punti (coordinate, valori) nella nostra struttura, mi sembra abbia piu senso ordinarli per valore... Per fare poi le varie operazioni per ricavare i sottopercorsi migliori...

Ce la faccio piu.

09-02-2006 11:20
Click Here to See the Profile for Simeon Click here to Send Simeon a Private Message Find more posts by Simeon Add Simeon to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
MaurizioL
.simpatizzante.

User info:
Registered: Feb 2006
Posts: 17 (0.00 al dì)
Location: Omegna
Corso: Informatica
Anno: 2
Time Online: 3:44:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Nosferatu
Una cosa ma il carattere end che gli passi come parametro, che carattere è


Non sò cme è fatto il vostro progetto;

Nel nostro c'era il comando di inserimento delle mappe:

m nome x y specifica

per leggere la stringa nome end deve essere uguale a spazio
(leggo tutti i caratteri che compongono il nome fino allo spazio)
per leggere la specifica end deve essere uguale a '\n'.

__________________
Maurizio Lombardi
Linux 2.6.14.2
-----------------------

09-02-2006 11:24
Click Here to See the Profile for MaurizioL Click here to Send MaurizioL a Private Message Find more posts by MaurizioL Add MaurizioL to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ornati
.primate.

User info:
Registered: Apr 2005
Posts: 78 (0.01 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 21:49:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by MaurizioL
Io nerd?

Leggi i sorgenti di Ornati e poi mi dici

http://www.dsy.it/forum/showthread....&threadid=24001

:-D


No, no... io non programmo mai a basso livello:

http://ornati.altervista.org/

;)

09-02-2006 11:29
Click Here to See the Profile for ornati Find more posts by ornati Add ornati to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Polsy
.arcimaestro.

User info:
Registered: Dec 2003
Posts: 477 (0.06 al dì)
Location:
Corso: Info phd
Anno:
Time Online: 17 Days, 17:11:50 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by ornati
No, no... io non programmo mai a basso livello:

http://ornati.altervista.org/

;)


si ma quanto te la meni :D

09-02-2006 12:31
Click Here to See the Profile for Polsy Click here to Send Polsy a Private Message Visit Polsy's homepage! Find more posts by Polsy Add Polsy to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Simeon
:D

User info:
Registered: Aug 2004
Posts: 984 (0.13 al dì)
Location: Milano
Corso: Informatica
Anno: IT IS OVER!
Time Online: 14 Days, 19:29:42 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

A uso e consumo di tutti, riguardo la nota 3, ecco cosa mi ha risposto il prof Fiorentini:

_______________
La regola le serve per determinare il valore di un generico punto (X,Y).

Esempio:


Se m=3 e n=2 e il file contiene i valori

0 1 2 3 4 5

allora:

Val(0,0) = Val(3,0) = Val(6,0) = Val(-3,0) = Val(-6,0) = ..... = 0
Val(1,0) = Val(4,0) = Val(7,0) = Val(-2,0) = Val(-5,0) = ..... = 1

Val(0,1) = Val(3,1) = Val(5,1) = Val(-3,1) = Val(-6,1) = ..... = 3



E' come se ricoprisse il piano con tanti rettangoli adiacenti
della forma

3 4 5
0 1 2

ottenendo

...............
..3 4 5 3 4 5..
..0 1 2 0 1 2..
..3 4 5 3 4 5..
..0 1 2 0 1 2..
...............

09-02-2006 13:16
Click Here to See the Profile for Simeon Click here to Send Simeon a Private Message Find more posts by Simeon Add Simeon to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ornati
.primate.

User info:
Registered: Apr 2005
Posts: 78 (0.01 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 21:49:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Polsy
si ma quanto te la meni :D


Suvvia... stavo solo facendo pubblicità ad un mio INUTILE progetto.

:)

Tanto per restare in OT: ho visto che anche tu devi fare l'orale di FRO... quindi ci si vede lunedì (a parte che non so chi sei...).

09-02-2006 13:24
Click Here to See the Profile for ornati Find more posts by ornati Add ornati to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ornati
.primate.

User info:
Registered: Apr 2005
Posts: 78 (0.01 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 21:49:35 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Simeon
_______________
E' come se ricoprisse il piano con tanti rettangoli adiacenti
della forma
............... [/B]


E` proprio per questo che non devi memorizzare niente (a parte un array con i valori che leggi dal file).

09-02-2006 13:28
Click Here to See the Profile for ornati Find more posts by ornati Add ornati to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Diuzza
.illuminato.

User info:
Registered: Aug 2004
Posts: 169 (0.02 al dì)
Location:
Corso: Informatica
Anno: 2
Time Online: 1 Day, 8:30:45 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Mi chiedevo.
In crea il nome del file ha lunghezza che fisso io o può essere lungo quanto vuole. Perchè avrei dei problemini nella lettura del file. Nel senso che se non ho una lunghezza fissata non so che dimensione deve avere l'arrey che contiene la stringa

09-02-2006 15:52
Click Here to See the Profile for Diuzza Click here to Send Diuzza a Private Message Find more posts by Diuzza Add Diuzza to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
MaurizioL
.simpatizzante.

User info:
Registered: Feb 2006
Posts: 17 (0.00 al dì)
Location: Omegna
Corso: Informatica
Anno: 2
Time Online: 3:44:01: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by Diuzza
Mi chiedevo.
In crea il nome del file ha lunghezza che fisso io o può essere lungo quanto vuole. Perchè avrei dei problemini nella lettura del file. Nel senso che se non ho una lunghezza fissata non so che dimensione deve avere l'arrey che contiene la stringa


C'è realloc apposta; l'ho scritto prima.
Riadatta il codice alle tue esigenze.

__________________
Maurizio Lombardi
Linux 2.6.14.2
-----------------------

09-02-2006 15:55
Click Here to See the Profile for MaurizioL Click here to Send MaurizioL a Private Message Find more posts by MaurizioL Add MaurizioL to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Diuzza
.illuminato.

User info:
Registered: Aug 2004
Posts: 169 (0.02 al dì)
Location:
Corso: Informatica
Anno: 2
Time Online: 1 Day, 8:30:45 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by MaurizioL
Se tu rappresenti la specifica con una lista ogni nuovo carattere deve essere inserito in coda....
Quindi o ci impieghi O(n^2) per compiere O(n) operazioni di inserimento oppure utilizzi una variabile globale che punta alla fine della lista, ma le variabili globali non sono consentite!




typedef struct nodolista{
char spec;
struct nodolista* next;
}nodo

typedef struct lista{
nodo* inizio;
nodo* fine;
}lista

typedef struct mappa{
lista* specifica;
int x,y;
char * nome;
}
no?

09-02-2006 16:00
Click Here to See the Profile for Diuzza Click here to Send Diuzza a Private Message Find more posts by Diuzza Add Diuzza to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Diuzza
.illuminato.

User info:
Registered: Aug 2004
Posts: 169 (0.02 al dì)
Location:
Corso: Informatica
Anno: 2
Time Online: 1 Day, 8:30:45 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ho visto il codice di prima ma creo un array char nome[100] per magari inserire solo 4 caratteri.

09-02-2006 16:04
Click Here to See the Profile for Diuzza Click here to Send Diuzza a Private Message Find more posts by Diuzza Add Diuzza to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 23:39.    Post New Thread    Post A Reply
Pages (17): « 1 2 3 [4] 5 6 7 8 » ... Last »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.200 seconds (60.63% PHP - 39.37% MySQL) con 24 query.