Skip to content

iristao/API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Team API

Pacy Yan, Iris Tao, Aryan Bhatt


Why we chose DLList:

- double-linked-list gives deque its double-linked feature because DLLNode offers both prev and next - (ie. methods like get/setPrev, get/setNext) - It makes it a lot easier to implement the double-direction feature.

Methods Selections:

addFirst:

- offerFirst is a necessary part of the Deque interface because it allows us to insert an element at the beginning at either beginning of the Deque. We chose to write offerFirst instead of addFirst because we thought it would be useful for us to be able to check whether or not the thing we added was successful instead of having to look at the entire stack.

addLast:


- offerLast is a necessary part of the Deque interface because it allows us to insert an element at either end of the Deque. We chose to write offerLast instead of addLast because we thought it would be useful for us to be able to check whether or not the thing we added was successful instead of having to look at the entire stack.

pollFirst:


- pollFirst is a necessary part of the Deque interface because it returns the value at either front of the deque and removes it. We chose to write pollFirst over removeFirst because it can be used without having to throw an exception and instead just checks if the deque is empty.

pollLast:


- pollLast is a necessary part of the deque interface because it returns the value at either end of the deque and removes it. We chose to write pollLast over removeLast because it can be used without having to throw an exception and instead just checks if the deque is empty.

peekFirst:


- peekFirst is a necessary part of the deque interface because it allows us to see what the value at either of the fronts is. We chose to write peekFirst over getFirst because it can be used without having to throw an exception and instead just checks if the deque is empty and returns null.

peekLast:


- peekLast is a necessary part of the deque interface because it allows us to see what the value at either ends is. We chose to write peekLast over getLast because it can be used without having to throw an exception and instead just checks if the deque is empty and returns null.


Changes Made

- We changed offerFirst and offerLast to addFirst and addLast in response to team BNTWomen's code review. The reason why the methods on the code and readme file didn't match the first time was because we changed our mind while coding but forgot to revise the readme file. Apologies for that.

- We moved the "Why we chose DLLNode" section from the bottom to the top of the file and got rid of the problem of that part being a code block instead of formatted text. The reason why that problem occurred remains unknown. But moving it up did give back did fix the formatting issue.

- Bugs fixed! We did not include a main method in the first place and so the code didn't compile. We added a main method with some test cases and fixed a lot of bugs in our code (typos, wrong variable and method names, incompatible return types, etc.) which we didn't discover before. Now the code compiles correctly and displays the test results.

- API updated!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages