home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!gatech!usenet.ins.cwru.edu!po.CWRU.Edu!wct
- From: wct@po.CWRU.Edu (William C. Thompson)
- Subject: Re: Sparse matrices (comparison of methods)
- Message-ID: <1992Jul22.234424.3870@usenet.ins.cwru.edu>
- Sender: news@usenet.ins.cwru.edu
- Nntp-Posting-Host: cwns5.ins.cwru.edu
- Reply-To: wct@po.CWRU.Edu (William C. Thompson)
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- References: <BrsxF5.DIw@news.cso.uiuc.edu> <1992Jul20.042405.6954@usenet.ins.cwru.edu>
- Date: Wed, 22 Jul 92 23:44:24 GMT
- Lines: 30
-
-
- Before I had proposed that each node contain four pointers, left, right,
- down, and up, and you enter each row/column through one of two doubly
- linked lists. Each node stores its position in the array. This has
- the advantage of being able to process elements in either order, up
- or down, very quickly. Unfortunately, each cell requires 20 bytes,
- which can add up quickly. 500 elements (not unheard od) would need
- 10K in pointers alone. Not to mention the 10 bytes needed for each
- row and column. At worst, this array would use 5K of pointers. At
- best, a little more than 220 bytes. 15K isn't catastrophic for 500
- elements. Any non-trivial application probably has data that dwarves
- the 15K. The main problem is speed. If you are accessing elements
- at the end of lists, it could take a while.
-
- Another suggestion has been to use doubly-linked lists for each row
- and have a list pointers into the rows. This uses half as much memory
- (potentially), but you lose the ability to go in each direction with
- ease and speed.
-
- You could also use trees instead of linked lists. The speed is there,
- but going from element to a nearby element can be awkward. Going in
- both directions isn't there either.
-
- As usual, it depends on your application what you decide.
- --
-
- [currently under construction]
-
-
-