oldk1331 wrote:
>  
>      reverse! d ==
> -        tmp := d.front
> -        d.front := d.rear
> -        d.rear := tmp
> +        empty? d => d
> +        empty? d.rear => d

You probably want:
           empty? d.rear =>
               d.front := reverse!(d.front)
               d
  
> +        (d.front, d.rear) := (d.rear, d.front)
>          d
>      -- StackAggregate's exclusive operations
> 
> 
> > but it is not clear if we will get any practical gain in speed
> 
> > (but extractBottom! in Dequeue is still O(n)). 
> 
> As you said, for small numbers of elements, my version
> will not get more slower; for large numbers of elements,
> my version is O(1) for insertion and extraction for both
> ends while current version is O(n) for some operations.

The point is that Queue and Dequeue are currently unused,
so even if we made them infinitely fast it would not
affect normal computations.

> What's the point of Dequeue if it can't inset/extract in O(1)?

It specifies abstract interface.  If there is practical need
for faster operation we can provide faster implementation
of the interface.
-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to