Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#!

/usr/bin/perlmo package Heap; sub new { my $class = shift; my $self = { aref => [""], nex => 1, @_}; bless $self,$class; } sub print { my $self = shift; my $next = $self->{nex}; my $aref = $self->{aref}; print "Array = @$aref\n"; print "next = $next\n"; } sub add { my ($self, $value) = shift; my $index = $self->{nex}; $self->{aref}[$index] = $value; $self->{nex}++; } 1;

You might also like