Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
_list_pq.c
Package: leda.tar.gz [view]
Upload User: gzelex
Upload Date: 2007-01-07
Package Size: 707k
Code Size: 1k
Category:
Mathimatics-Numerical algorithms
Development Platform:
MultiPlatform
- /*******************************************************************************
- +
- + LEDA-R 3.2.3
- +
- + _list_pq.c
- +
- + Copyright (c) 1995 by Max-Planck-Institut fuer Informatik
- + Im Stadtwald, 66123 Saarbruecken, Germany
- + All rights reserved.
- +
- *******************************************************************************/
- #include <LEDA/impl/list_pq.h>
- list_pq::list_pq(const list_pq&) { /* copy constructor */}
- list_pq& list_pq::operator=(const list_pq&) { /* assignment */ return *this; }
- list_pq_item list_pq::insert(GenPtr k,GenPtr i)
- { copy_key(k);
- copy_inf(i);
- list_pq_item p = new list_pq_elem(k,i,nil,head);
- if (head) head->pred = p;
- head = p;
- count++;
- return p;
- }
- list_pq_item list_pq::find_min() const
- { list_pq_item p = head;
- list_pq_item m = head;
- if (int_type())
- while (p)
- { if (LEDA_ACCESS(int,p->key) < LEDA_ACCESS(int,m->key)) m = p;
- p = p->succ;
- }
- else
- while (p)
- { if (cmp(p->key,m->key) < 0) m = p;
- p = p->succ;
- }
- return m;
- }
- void list_pq::del_item(list_pq_item it)
- { list_pq_item p = it->pred;
- list_pq_item s = it->succ;
- if (p) p->succ = s;
- else head = s;
- if (s) s->pred = p;
- count--;
- }
- void list_pq::clear()
- { while (head)
- { list_pq_item p = head->succ;
- clear_key(head->key);
- clear_inf(head->inf);
- delete head;
- head = p;
- }
- count = 0;
- }