中级农民
- 积分
- 222
- 大米
- 颗
- 鳄梨
- 个
- 水井
- 尺
- 蓝莓
- 颗
- 萝卜
- 根
- 小米
- 粒
- 学分
- 个
- 注册时间
- 2017-2-24
- 最后登录
- 1970-1-1
|
- Now we are testing DList.
- Here is a list after insertBack 6, 9, 12: [ 6 9 12 ]
- Here is the same list after insertBack(15) and insertFront(3): [ 3 6 9 12 15 ]
- front() should be 3. It is: 3
- front's next should be 6. It is: 6
- front's next's prev should be 3. It is: 3
- After remove the front, the front() should be 6. It is: 6
- After insertBefore() and insertAfter(), The first 3 nodes should be 5,6,8. The list is: [ 5 6 8 9 12 15 ]
- Here is a list after construction: [ ]
- isEmpty() should be true. It is: true
- length() should be 0. It is: 0
- Here is a list after insertFront(3) to an empty list: [ 3 ]
- Here is a list after insertBack(5) on an empty list: [ 5 ]
- Here is a list after insertFront 3, 2, 1: [ 1 2 3 ]
- isEmpty() should be false. It is: false
- length() should be 3. It is: 3
- Here is the same list after insertBack(4): [ 1 2 3 4 ]
- Here is a list after insertBack 6, 7: [ 6 7 ]
- isEmpty() should be false. It is: false
- length() should be 2. It is: 2
- Here is the same list after insertFront(5): [ 5 6 7 ]
复制代码- Now we are testing LockDList.
- Here is a list after insertBack 6, 9, 12: [ 6 9 12 ]
- Here is the same list after insertBack(15) and insertFront(3): [ 3 6 9 12 15 ]
- front() should be 3. It is: 3
- front's next should be 6. It is: 6
- front's next's prev should be 3. It is: 3
- We lockNode front()= 3
- After remove the locked front, the front() should still be 3. It is: 3
- After remove the back, the back() should be 12. It is: 12
- After insertBefore(3) and insertAfter(3), The first 3 nodes should be 5,3,8. The list is: [ 5 3 8 6 9 12 ]
- Here is a list after construction: [ ]
- isEmpty() should be true. It is: true
- length() should be 0. It is: 0
- Here is a list after insertFront(3) to an empty list: [ 3 ]
- Here is a list after insertBack(5) on an empty list: [ 5 ]
- Here is a list after insertFront 3, 2, 1: [ 1 2 3 ]
- isEmpty() should be false. It is: false
- length() should be 3. It is: 3
- Here is the same list after insertBack(4): [ 1 2 3 4 ]
- Here is a list after insertBack 6, 7: [ 6 7 ]
- isEmpty() should be false. It is: false
- length() should be 2. It is: 2
- Here is the same list after insertFront(5): [ 5 6 7 ]
复制代码 打卡打卡打卡!
|
|