delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/09/30/13:06:51

Message-ID: <004101bdec94$27fdc7a0$0f1919c8@mpereze>
From: "Miguel A Pérez E" <mpereze AT lasalle DOT edu DOT co>
To: <djgpp AT delorie DOT com>
Subject: help with size of trees, and big arrays..
Date: Wed, 30 Sep 1998 12:02:22 -0500
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3

Hi, how can I do program that manages an array of user
defined size?
The following gives me an error

void main (void){
    int Tamano;
    scanf("%d", &Tamano);
    int Arreglo[Tamano][Tamano];
}

It says that a constant is expected..

I have two more questions:

First:

I have an structure like this:

// arbol cuaternario
struct ArbCuat{
// Nombre y atributo
int Nombre;
int Atributo;
// Coordenada y arista
int X1;
int Y1;
int Arista;
// Nodos hijos
struct ArbCuat *NorEste;
struct ArbCuat *NorOeste;
struct ArbCuat *SurEste;
struct ArbCuat *SurOeste;
// Grafo: Lista de vecinos
struct Vecinos *Primero;
};

ArbCuat *Vehiculo;
ArbCuat *Meta;
ArbCuat *Raiz;


//Lista enlazada de vecinos de celdas y apuntadores a las
mismas
struct Vecinos{
//Apuntador al vecino actual
ArbCuat *Actual;
//Apuntador  al siguiente elemento que contiene
//apuntador al siguiente Vecino
struct Vecinos *Siguiente;
};

Vecinos *Vecino;
Vecinos *Anterior;

Later, the program sets Raiz to a quadtree, where each
node/leaf of it is of
type ArbCuat. How do I to determine the real size of the
tree Raiz, in
bytes? sizeof() operator gives me this values:
sizeof(Raiz) = 4
sizeof(*Raiz) = 40
Are these correct?
I counted the number of generated nodes/leaves and
multiplied by 40 gave me
176KB, if this is likely right?


//2:

Also the program has to work with an integer array of
maximum 2000 *2000 and
vectors of size 2000 maximum. Is there a faster way to
obtain the
boolean -vectorial product between the vector an the array?
I have seen that
in this extreme conditions (for me at least) the computer
turns very
occupied and slow in it performance.
It is possible to replace the int array by a bit-level array
(given that I
am working only with 0 and 1). How can I do that?


Thank you in advice..

Miguel Pérez
mpereze AT lasalle DOT edu DOT co
www.lasalle.edu.co/~mpereze


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019