|
|
Up |
|
|
  |
Author: e p chandlere p chandler Date: Sep 16, 2008 11:30
See http://www.pcc.qub.ac.uk/tec/courses/f77tof90/stu-notes/f90studentMIF_6.html
for code which creates, traverses and destroys a linked list. Note
that this is a stack - last in - first out.
I found the code a bit quirky and decided to write my own so that the
list would be traversed in the order in which items were entered. So I
sat down and wrote out the following on a legal pad. It compiled and
ran on the first try!
program linked_list
implicit none
type node
integer :: i
type(node), pointer :: p
end type node
type(node), pointer :: h, t, c
integer :: i
nullify(h)
do
read *, i
if ( i == 0 ) exit
|
| Show full article (1.11Kb) |
|
| | 7 Comments |
|
  |
|
|
  |
Author: glen herrmannsfeldtglen herrmannsfeldt Date: Sep 17, 2008 02:18
Ron Ford wrote:
(snip)
> I'm given to understand that data structures on Turing-complete machines
> are somehow all the same. Glen mentioned that the directory
> structure--folders--for the original apples was flat, as opposed to the
> tree I think of when I think of a directory.
The original MacOS when they only used floppies or small
hard disks.
The file system for OS/360, and still used with the
successors to OS/360, uses a flat 44 character name space.
It is normally divided up with somewhat like group.username.filename
(Newer systems use both hierarchical (unix like) file system
and the MVS file system at the same time.)
-- glen
|
| |
| no comments |
|
  |
Author: Kurt KallbladKurt Kallblad Date: Sep 17, 2008 03:49
> See
> http://www.pcc.qub.ac.uk/tec/courses/f77tof90/stu-notes/f90studentMIF_6.html
> for code which creates, traverses and destroys a linked list.
> Note
> that this is a stack - last in - first out.
>
> I found the code a bit quirky and decided to write my own so
> that the
> list would be traversed in the order in which items were
> entered. So I
> sat down and wrote out the following on a legal pad. It
> compiled and
> ran on the first try!
>
> program linked_list
> implicit none
>
> type node ...
|
| Show full article (2.19Kb) |
| no comments |
|
  |
|
|
  |
Author: Ron FordRon Ford Date: Sep 18, 2008 21:20
On Tue, 16 Sep 2008 11:30:59 -0700 (PDT), e p chandler posted:
> I acutally understand what this code does! The only subtle part is
>
> t%%p => c
>
> --- If the list is NOT empty, add the newly created node onto the
> chain.
What data did you use to test?
--
Wealth - any income that is at least one hundred dollars more a year than
the income of one's wife's sister's husband.
H. L. Mencken
|
| |
| no comments |
|
  |
Author: e p chandlere p chandler Date: Sep 19, 2008 05:16
On Sep 19, 12:20Â am, Ron Ford wrote:
> On Tue, 16 Sep 2008 11:30:59 -0700 (PDT), e p chandler posted:
>
>> I acutally understand what this code does! The only subtle part is
>
>> t%%p => c
>
>> --- If the list is NOT empty, add the newly created node onto the
>> chain.
>
> What data did you use to test?
The read loop exits when a 0 is entered, so I tried lists with 0
through 5 members. For lists of length N, for N = 2 to 3, I tried all
permutations of the integers from 1 to N.
[Proof that all odd numbers are prime - 3 is prime, 5 is prime, 7 is
prime ..... :-)]
- e
|
| |
| no comments |
|
  |
|
|
  |
Author: Ron FordRon Ford Date: Sep 22, 2008 19:25
On Fri, 19 Sep 2008 05:16:50 -0700 (PDT), e p chandler posted:
> On Sep 19, 12:20Â am, Ron Ford wrote:
>> On Tue, 16 Sep 2008 11:30:59 -0700 (PDT), e p chandler posted:
>>
>>> I acutally understand what this code does! The only subtle part is
>>
>>> t%%p => c
>>
>>> --- If the list is NOT empty, add the newly created node onto the
>>> chain.
>>
>> What data did you use to test?
>
> The read loop exits when a 0 is entered, so I tried lists with 0
> through 5 members. For lists of length N, for N = 2 to 3, I tried all
> permutations of the integers from 1 to N.
|
| Show full article (1.29Kb) |
| no comments |
|
|