楼主: jaly50
跳转到指定楼层
上一主题 下一主题
收起左侧

Berkeley CS 61B Data Structures(in Java) Homework5 加分+讨论帖

 
🔗
psychewww 2017-9-24 08:40:35 | 只看该作者
全局:
  1. An empty list should be [  ]: [  ]
  2. l.isEmpty() should be true: true
  3. l.length() should be 0: 0
  4. Finding front node p of l.
  5. p.isValidNode() should be false: false
  6. p.item() should throw an exception, and did.
  7. p.setItem() should throw an exception, and did.
  8. p.next() should throw an exception, and did.
  9. p.prev() should throw an exception, and did.
  10. p.insertBefore() should throw an exception, and did.
  11. p.insertAfter() should throw an exception, and did.
  12. p.remove() should throw an exception, and did.
  13. Finding back node p of l.
  14. p.isValidNode() should be false: false
  15. p.item() should throw an exception, and did.
  16. p.setItem() should throw an exception, and did.
  17. p.next() should throw an exception, and did.
  18. p.prev() should throw an exception, and did.
  19. p.insertBefore() should throw an exception, and did.
  20. p.insertAfter() should throw an exception, and did.
  21. p.remove() should throw an exception, and did.
  22. l after insertFront(10) should be [  10  ]: [  10  ]
  23. l is a list of 3 elements: [  1  2  3  ]
  24. n.item() should be 1: 1
  25. n.item() should be 2: 2
  26. n.item() should be 2: 2
  27. n.item() should be 4: 4
  28. n.item() should be 3: 3
  29. n.item() should be 6: 6
  30. After doubling all elements of l: [  2  4  6  ]
  31. p.isValidNode() should be false: false
  32. p.item() should throw an exception, and did.
  33. p.setItem() should throw an exception, and did.
  34. p.next() should throw an exception, and did.
  35. p.prev() should throw an exception, and did.
  36. p.insertBefore() should throw an exception, and did.
  37. p.insertAfter() should throw an exception, and did.
  38. p.remove() should throw an exception, and did.
  39. n.item() should be 6: 6
  40. n.item() should be 12: 12
  41. n.item() should be 4: 4
  42. n.item() should be 8: 8
  43. n.item() should be 2: 2
  44. n.item() should be 4: 4
  45. After doubling all elements of l again: [  4  8  12  ]
  46. p.isValidNode() should be false: false
  47. p.item() should throw an exception, and did.
  48. p.setItem() should throw an exception, and did.
  49. p.next() should throw an exception, and did.
  50. p.prev() should throw an exception, and did.
  51. p.insertBefore() should throw an exception, and did.
  52. p.insertAfter() should throw an exception, and did.
  53. p.remove() should throw an exception, and did.
  54. Removing middle element (8) of l: 8
  55. l is now: [  4  12  ]
  56. p.isValidNode() should be false: false
  57. p.item() should throw an exception, and did.
  58. p.setItem() should throw an exception, and did.
  59. p.next() should throw an exception, and did.
  60. p.prev() should throw an exception, and did.
  61. p.insertBefore() should throw an exception, and did.
  62. p.insertAfter() should throw an exception, and did.
  63. p.remove() should throw an exception, and did.
  64. Removing end element (12) of l: 12
  65. l is now: [  4  ]
  66. p.isValidNode() should be false: false
  67. p.item() should throw an exception, and did.
  68. p.setItem() should throw an exception, and did.
  69. p.next() should throw an exception, and did.
  70. p.prev() should throw an exception, and did.
  71. p.insertBefore() should throw an exception, and did.
  72. p.insertAfter() should throw an exception, and did.
  73. p.remove() should throw an exception, and did.
  74. Removing first element (4) of l: 4
  75. l is now: [  ]
  76. p.isValidNode() should be false: false
  77. p.item() should throw an exception, and did.
  78. p.setItem() should throw an exception, and did.
  79. p.next() should throw an exception, and did.
  80. p.prev() should throw an exception, and did.
  81. p.insertBefore() should throw an exception, and did.
  82. p.insertAfter() should throw an exception, and did.
  83. p.remove() should throw an exception, and did.
复制代码
  1. Set s = { 3 4 }
  2. Set s2 = { 4 5 }
  3. Set s3 = { 3 5 8 }
  4. After s.union(s2), s = { 3 4 5 }
  5. After s.intersect(s3), s = { 3 5 }
  6. s.cardinality() = 2
复制代码
回复

使用道具 举报

🔗
ddy301 2017-10-2 10:52:35 | 只看该作者
全局:
打卡,union和intersect的边界条件有点多
DList:










Set:


回复

使用道具 举报

🔗
skyevil12 2017-11-14 10:51:55 | 只看该作者
全局:
花了一天 解決了

  1. D:\Git\DSA\CS61B\hw5>java -ea list.DList
  2. An empty list should be [  ]: [  ]
  3. l.isEmpty() should be true: true
  4. l.length() should be 0: 0
  5. Finding front node p of l.
  6. p.isValidNode() should be false: false
  7. p.item() should throw an exception, and did.
  8. p.setItem() should throw an exception, and did.
  9. p.next() should throw an exception, and did.
  10. p.prev() should throw an exception, and did.
  11. p.insertBefore() should throw an exception, and did.
  12. p.insertAfter() should throw an exception, and did.
  13. p.remove() should throw an exception, and did.
  14. Finding back node p of l.
  15. p.isValidNode() should be false: false
  16. p.item() should throw an exception, and did.
  17. p.setItem() should throw an exception, and did.
  18. p.next() should throw an exception, and did.
  19. p.prev() should throw an exception, and did.
  20. p.insertBefore() should throw an exception, and did.
  21. p.insertAfter() should throw an exception, and did.
  22. p.remove() should throw an exception, and did.
  23. l after insertFront(10) should be [  10  ]: [  10  ]
  24. l is a list of 3 elements: [  1  2  3  ]
  25. n.item() should be 1: 1
  26. n.item() should be 2: 2
  27. n.item() should be 2: 2
  28. n.item() should be 4: 4
  29. n.item() should be 3: 3
  30. n.item() should be 6: 6
  31. After doubling all elements of l: [  2  4  6  ]
  32. p.isValidNode() should be false: false
  33. p.item() should throw an exception, and did.
  34. p.setItem() should throw an exception, and did.
  35. p.next() should throw an exception, and did.
  36. p.prev() should throw an exception, and did.
  37. p.insertBefore() should throw an exception, and did.
  38. p.insertAfter() should throw an exception, and did.
  39. p.remove() should throw an exception, and did.
  40. n.item() should be 6: 6
  41. n.item() should be 12: 12
  42. n.item() should be 4: 4
  43. n.item() should be 8: 8
  44. n.item() should be 2: 2
  45. n.item() should be 4: 4
  46. After doubling all elements of l again: [  4  8  12  ]
  47. p.isValidNode() should be false: false
  48. p.item() should throw an exception, and did.
  49. p.setItem() should throw an exception, and did.
  50. p.next() should throw an exception, and did.
  51. p.prev() should throw an exception, and did.
  52. p.insertBefore() should throw an exception, and did.
  53. p.insertAfter() should throw an exception, and did.
  54. p.remove() should throw an exception, and did.
  55. Removing middle element (8) of l: 8
  56. l is now: [  4  12  ]
  57. p.isValidNode() should be false: false
  58. p.item() should throw an exception, and did.
  59. p.setItem() should throw an exception, and did.
  60. p.next() should throw an exception, and did.
  61. p.prev() should throw an exception, and did.
  62. p.insertBefore() should throw an exception, and did.
  63. p.insertAfter() should throw an exception, and did.
  64. p.remove() should throw an exception, and did.
  65. Removing end element (12) of l: 12
  66. l is now: [  4  ]
  67. p.isValidNode() should be false: false
  68. p.item() should throw an exception, and did.
  69. p.setItem() should throw an exception, and did.
  70. p.next() should throw an exception, and did.
  71. p.prev() should throw an exception, and did.
  72. p.insertBefore() should throw an exception, and did.
  73. p.insertAfter() should throw an exception, and did.
  74. p.remove() should throw an exception, and did.
  75. Removing first element (4) of l: 4
  76. l is now: [  ]
  77. p.isValidNode() should be false: false
  78. p.item() should throw an exception, and did.
  79. p.setItem() should throw an exception, and did.
  80. p.next() should throw an exception, and did.
  81. p.prev() should throw an exception, and did.
  82. p.insertBefore() should throw an exception, and did.
  83. p.insertAfter() should throw an exception, and did.
  84. p.remove() should throw an exception, and did.

  85. D:\Git\DSA\CS61B\hw5>java -ea Set
  86. Set s = [  3  4  ]
  87. Set s2 = [  4  5  ]
  88. Set s3 = [  3  5  8  ]
  89. After s.union(s2), s = [  3  4  5  ]
  90. After s.intersect(s3), s = [  3  5  ]
  91. s.cardinality() = 2
复制代码
回复

使用道具 举报

🔗
zli4 2017-12-10 06:17:47 | 只看该作者
全局:
Part1:




Part2:



搞定啦~~谢谢分享的test case。求加分!
回复

使用道具 举报

🔗
dachou 2017-12-20 19:35:42 | 只看该作者
全局:
ParII用地里的test做的,这样case情况更多帮助查找问题。
PartII做了很久,在intersect这里卡了很久。 考虑的有:1)当 this set 是空时候,什么都不用做。即所有的case都是建立在 cardinality != 0的条件下
2) while curNode 和sNode都是valid的情况下再分三种情况讨论。即当2-1)curNode 和sNode一样时 2-2)当curNode > sNode  2-3)当curNode < sNode 时。
需要特别注意的是2-3这种情况,比如{4 5 8} 和{ 1 3 5 7 9} 进行intersect时,最后的8<9,body里面应该先temp = curNode.next(), 再curNode.remove()。若用temp.prev().remove()则会出错,因为8后面是null的,null的prev()没有,那么就remove不了8.  
3)从2结束之后还有两种情况,3-1)curNode invalid的情况,这种就不需要再任何事了。 3-2)当sNode invalid 时,需要把curNode里后面其他的node全部remove掉,方法和2-3 一样。
更多图片 小图 大图
组图打开中,请稍候......
回复

使用道具 举报

🔗
shi198 2017-12-30 12:45:50 | 只看该作者
全局:
第一部分DList很简单 稍微改一下就行了,运行结果就不贴le
第二部分的Set写起来有点麻烦 最主要要考虑到各种边界条件,我自己稍微再加了几个testcase测试一下


回复

使用道具 举报

全局:
第一部分最tricy的地方是DListNode中,新建node的部分
如下:
DListNode temp = ((DList)this.myList).newNode(item, (DList)this.myList, prev, this);
为什么this.myList需要做一个强制类型转换呢,一开始是IDE帮我加上的,我自己思考了下是为什么要加,原因是myList是从ListNode继承过来的field,reference type应该是List,然后newNode的method是在DList里面才定义了的,List里面并没有newNode这个method,DList是List的子类,所以要加一个(DList)确保这个我们想要的是DList中的newNode。
set class的部分,真的才让我理解到为什么把一部分函数封装进ListNode的函数中更加好。还有为什么要做这些父类子类的(想要更换SListNode或者DListNode只要在constructor中换一个地方就可以了)
public Set() {
  // Your solution here.
  this.list = new DList();
}




回复

使用道具 举报

🔗
greatlim 2018-2-21 13:52:23 | 只看该作者
全局:
liniua 发表于 2017-6-13 13:20
求教:Set的头 String如何将[  ]改成{  }形式?
Set里override toString()的话无法throws Exception,但 ...

需要重新写 toString() 函数
可以把DList的拿来修改下
回复

使用道具 举报

🔗
greatlim 2018-2-21 14:01:22 | 只看该作者
全局:
Part1
  1. /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=49858:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/tools.jar:/Users/Lim/@inbox/cs61b14/hw/hw5/out/production/hw5 list.DList
  2. An empty list should be [  ]: [  ]
  3. l.isEmpty() should be true: true
  4. l.length() should be 0: 0
  5. Finding front node p of l.
  6. p.isValidNode() should be false: false
  7. p.item() should throw an exception, and did.
  8. p.setItem() should throw an exception, and did.
  9. p.next() should throw an exception, and did.
  10. p.prev() should throw an exception, and did.
  11. p.insertBefore() should throw an exception, and did.
  12. p.insertAfter() should throw an exception, and did.
  13. p.remove() should throw an exception, and did.
  14. Finding back node p of l.
  15. p.isValidNode() should be false: false
  16. p.item() should throw an exception, and did.
  17. p.setItem() should throw an exception, and did.
  18. p.next() should throw an exception, and did.
  19. p.prev() should throw an exception, and did.
  20. p.insertBefore() should throw an exception, and did.
  21. p.insertAfter() should throw an exception, and did.
  22. p.remove() should throw an exception, and did.
  23. l after insertFront(10) should be [  10  ]: [  10  ]
  24. l is a list of 3 elements: [  1  2  3  ]
  25. n.item() should be 1: 1
  26. n.item() should be 2: 2
  27. n.item() should be 2: 2
  28. n.item() should be 4: 4
  29. n.item() should be 3: 3
  30. n.item() should be 6: 6
  31. After doubling all elements of l: [  2  4  6  ]
  32. p.isValidNode() should be false: false
  33. p.item() should throw an exception, and did.
  34. p.setItem() should throw an exception, and did.
  35. p.next() should throw an exception, and did.
  36. p.prev() should throw an exception, and did.
  37. p.insertBefore() should throw an exception, and did.
  38. p.insertAfter() should throw an exception, and did.
  39. p.remove() should throw an exception, and did.
  40. n.item() should be 6: 6
  41. n.item() should be 12: 12
  42. n.item() should be 4: 4
  43. n.item() should be 8: 8
  44. n.item() should be 2: 2
  45. n.item() should be 4: 4
  46. After doubling all elements of l again: [  4  8  12  ]
  47. p.isValidNode() should be false: false
  48. p.item() should throw an exception, and did.
  49. p.setItem() should throw an exception, and did.
  50. p.next() should throw an exception, and did.
  51. p.prev() should throw an exception, and did.
  52. p.insertBefore() should throw an exception, and did.
  53. p.insertAfter() should throw an exception, and did.
  54. p.remove() should throw an exception, and did.
  55. Removing middle element (8) of l: 8
  56. l is now: [  4  12  ]
  57. p.isValidNode() should be false: false
  58. p.item() should throw an exception, and did.
  59. p.setItem() should throw an exception, and did.
  60. p.next() should throw an exception, and did.
  61. p.prev() should throw an exception, and did.
  62. p.insertBefore() should throw an exception, and did.
  63. p.insertAfter() should throw an exception, and did.
  64. p.remove() should throw an exception, and did.
  65. Removing end element (12) of l: 12
  66. l is now: [  4  ]
  67. p.isValidNode() should be false: false
  68. p.item() should throw an exception, and did.
  69. p.setItem() should throw an exception, and did.
  70. p.next() should throw an exception, and did.
  71. p.prev() should throw an exception, and did.
  72. p.insertBefore() should throw an exception, and did.
  73. p.insertAfter() should throw an exception, and did.
  74. p.remove() should throw an exception, and did.
  75. Removing first element (4) of l: 4
  76. l is now: [  ]
  77. p.isValidNode() should be false: false
  78. p.item() should throw an exception, and did.
  79. p.setItem() should throw an exception, and did.
  80. p.next() should throw an exception, and did.
  81. p.prev() should throw an exception, and did.
  82. p.insertBefore() should throw an exception, and did.
  83. p.insertAfter() should throw an exception, and did.
  84. p.remove() should throw an exception, and did.

  85. Process finished with exit code 0
复制代码

Part2
  1. /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/bin/java "-javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=49896:/Applications/IntelliJ IDEA CE.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath /Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_161.jdk/Contents/Home/lib/tools.jar:/Users/Lim/@inbox/cs61b14/hw/hw5/out/production/hw5 Set
  2. Testing insert()
  3. Set s should be { 3 4 }: {  3  4  }
  4. Set s2 should be { 4 5 }: {  4  5  }
  5. Set s3 should be { 3 5 8 }: {  3  5  8  }

  6. Tesing union()
  7. After s.union(s2), s should be { 3 4 5 }: {  3  4  5  }
  8. After s2.union(s3), s2 should be { 3 4 5 8 }: {  3  4  5  8  }
  9. Empty set s4 = {  }
  10. After s.union(s4), s should be { 3 4 5 }: {  3  4  5  }
  11. After s4.union(s), s4 should be { 3 4 5 }: {  3  4  5  }

  12. Tesing intersect()
  13. {}.intersect({1}) should be { }: {  }
  14. {1}.intersect({}) should be { }: {  }
  15. {1}.intersect({1 2}) should be { 1 }: {  1  }
  16. {1 2 3}.intersect({1 2}) should be { 1 2 }: {  1  2  }
  17. {1 2 4 7}.intersect({1 2 3 5}) should be { 1 2 }: {  1  2  }

  18. Tesing cardinality()
  19. s.cardinality() should be 3: 3
  20. s4.cardinality() should be 3: 3
  21. s5.cardinality() should be 0: 0
  22. s6.cardinality() should be 4: 4
  23. s7.cardinality() should be 2: 2

  24. Process finished with exit code 0
复制代码
回复

使用道具 举报

🔗
greatlim 2018-2-21 14:06:49 | 只看该作者
全局:
总结下:
(1)遍历的边界条件可以用isValidNode()来判断
(2)如果item()是可以comparable的,比如这里是int,那么可以通过cast将其转换
(3)对于末尾的讨论 & 对于空集的讨论
(4)父类子类的设计使得DList和SList很容易的调换
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表