Author: Stan Eisenstat
Subject: Re: [Cs223] counting nodes in deque
Date: Friday, 20 Mar 2020, 12:36:32
> Message Posted By: Unknown
>
> Can we add functions to deque.h, such as a function to count the number of
> nodes in a deque?
No. As stated in the specification:
Your code MUST #include Hwk4/Deque.h, not a local copy.
=====
> Is there another way of counting the number of nodes in deque that doesn't
> require us to add a field in the deque struct? This is needed when doing
> the quickSorting (to identify base cases).
Yes, but it involves extra calls to addD() and pushD().
But there is no reason to count the number of items in a
Deque: main() can count the number of lines read, and
quickSort can count the number in each of the groups as
they are formed.
--Stan-
PREV
INDEX
NEXT