CARS

/home/nicola/Dropbox/Progetto SOL/CARS_terfram/src/heap.h

Go to the documentation of this file.
00001 
00009 /*    Copyright (C) 2011  Nicola Corti
00010 
00011     This program is free software: you can redistribute it and/or modify
00012     it under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     This program is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU General Public License for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024                  For further information, Nicola Corti - <cortin [at] cli.di.unipi.it>
00025 */
00026 
00027 
00028 #ifndef __HEAP_H
00029 #define __HEAP_H
00030 
00031 
00033 typedef struct heap_elem{
00034 
00036         unsigned int label;
00037         
00039         double dist;
00040         
00041 } heap_elem_t;
00042 
00044 typedef struct heap_array{
00045 
00047         unsigned int heap_size;
00048         
00050         heap_elem_t * array;
00051         
00052 } heap_array_t;
00053 
00054 
00055 
00062 int is_empty(heap_array_t * coda);
00063 
00064 
00070 void enqueue(heap_array_t * coda, unsigned int elem, double dist);
00071 
00072 
00081 int decrease_key(heap_array_t * coda, unsigned int elem, double new_dist);
00082 
00083 
00089 int dequeue(heap_array_t * coda);
00090 
00091 #endif