使用数组和链表实现背包、队列、栈3种集合类数据结构 | GCidea's blog
目录1. API1.1. 背包1.2. 队列1.3. 栈2. 实现2.1. 背包2.2. 队列2.3. 栈
API背包
队列
栈
实现背包1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798public class Bag<Item> implements Iterable<Item> { private Node<Item> first; // beginning of bag private int n; // number of elements in bag // helper linked list class private static class Node<Item> { p...阅读全文
API背包
队列
栈
实现背包1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798public class Bag<Item> implements Iterable<Item> { private Node<Item> first; // beginning of bag private int n; // number of elements in bag // helper linked list class private static class Node<Item> { p...阅读全文