摘要: time complexity: offer(), size(), isEmpty(): o(1) for poll and peek: worst case: offer n times, peek/poll only once: o(n) average case: offer n times, 阅读全文
posted @ 2018-02-20 23:50 davidnyc 阅读(202) 评论(0) 推荐(0)
摘要: Stack: LIFO, the Stack is a deprecated interface we should use Deque interface. The implementation can use LinkedList or array push, pop, peek, size() 阅读全文
posted @ 2018-02-20 23:07 davidnyc 阅读(161) 评论(0) 推荐(0)
摘要: queue: FIFO, Queue is interface, the implementation could be LinkedList or array offer, poll, peek, size() isEmpty() 阅读全文
posted @ 2018-02-20 22:59 davidnyc 阅读(121) 评论(0) 推荐(0)
摘要: 时间: o(n) 空间 o(1): 没有recursion, 只有当前一层的call stack sorting 如果是general sorting algo(1:不能对数组的性质加以限制) comparison based(2: sorting 只能通过两个数的比较来进行) , 最好的时间复杂度 阅读全文
posted @ 2018-02-20 08:08 davidnyc 阅读(218) 评论(0) 推荐(0)