摘要:
Queue是java中实现队列的接口,它总共只有6个方法,我们一般只用其中3个就可以了。Queue的实现类有LinkedList和PriorityQueue。最常用的实现类是LinkedList。 压入元素(添加):add()、offer() 相同:未超出容量,从队尾压入元素,返回压入的那个元素。区 阅读全文
摘要:
StackDemo: 阅读全文
摘要:
/** * * @author gentleKay * Given a linked list, swap every two adjacent nodes and return its head. * For example, * Given1->2->3->4, you should retur 阅读全文
摘要:
/** * * @author gentleKay * Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. * 阅读全文