Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Test
#1
Hi,

I wrote some simple tests program for all 4 classes with screenshots of my outputs.
Please feel free to check this out and see if our outputs are the same.

Thanks!


Attached Files Thumbnail(s)
       

.zip   Assignment0-Test.zip (Size: 4.15 KB / Downloads: 35)
Reply
#2
(09-06-2017, 06:39 PM)aluong Wrote: Hi,

I wrote some simple tests program for all 4 classes with screenshots of my outputs.
Please feel free to check this out and see if our outputs are the same.

Thanks!

Queues are FIFO while Stacks are LIFO. For your queue you are implementing it as a LIFO just like a stack. I would reverse the order. Also, your visualizeDA goes from [1][1] to [2][1] after setting. The DA should never be at [2][1] because it always doubles or halves. If the values don't add up to a multiple of 2 (except for [1][0] or [0][1]), they aren't possible. So the second visualizeDA should be [2][0] (you don't have to increase size until attempting to insert into a full array).
Reply
#3
(09-06-2017, 11:43 PM)Arife1 Wrote: Queues are FIFO while Stacks are LIFO. For your queue you are implementing it as a LIFO just like a stack. I would reverse the order. Also, your visualizeDA goes from [1][1] to [2][1] after setting. The DA should never be at [2][1] because it always doubles or halves. If the values don't add up to a multiple of 2 (except for [1][0] or [0][1]), they aren't possible. So the second visualizeDA should be [2][0] (you don't have to increase size until attempting to insert into a full array).

My Queue display function is wrong.

However, I think there's a bit of confusion about your point regarding the visualizeDA. [2][1] means that there is only 1 item in the array, 2, and the number of the remaining slot is 1.
Reply
#4
visualizeDA() prints the array, then the number of empty slots. So, if in an array of capacity 2, there is one item, in this example, the number 2, visualizeDA() should print out [2][1].

That being said, an empty array should have a capacity of 1 (0 < .25 * 2), so visualizeDA() should print [][1] for each empty array.
I don't know what I don't know, but I do know what you don't know.
Reply
#5
As stated in another thread, it is possible to have an empty array with capacity 2, so [][2] can happen.
Reply
#6
I guess it's a difference in my code that seems to ensure all empty arrays are [] [1]. Errare humanum est.
I don't know what I don't know, but I do know what you don't know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)