Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Advertisements

4 thoughts on “Hello world!

  1. class Min_stack {
    
        has @.stack;    
        has @.min;
        
    
        method push($item) {
    	push @.stack, $item;  
    	if @.min==0 or @.min[*-1] > $item {
    	    push @.min, $item;
    	}
        }
    
        method pop() {	
    	my $item=pop @.stack;
    	if $item == @.min[*-1] {
    	    pop @.min;
    	}
    	return $item;
        }
    
        method min() {
    	@.min[*-1];
        }
    
    }
    

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s