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

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

 
🔗
Yoonlee 2016-8-2 23:14:40 | 只看该作者
全局:
这次的作业做了很久,断断续续地做,一开始很多不懂得地方,第一个都做不出来。。。
终于完成了,哈哈哈哈哈哈
求学分!!
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
xavier90 2016-8-2 23:54:15 | 只看该作者
全局:
终于把作业做完了,这次的作业用了好长的时间
主要还是对于异常和多态不熟练,这次算是有些眉目了
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
forests 2016-8-10 08:55:58 | 只看该作者
全局:
本帖最后由 forests 于 2016-8-10 08:56 编辑

我用了之前@althinking 同学的测试数据。
(另外一天只能发5张图真是太少了。。。。导致还有一张没法上传。。。。只能贴出来了)
An empty list should be [  ]: [  ]
l.isEmpty() should be true: true
l.length() should be 0: 0
Finding front node p of l.
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
Finding back node p of l.
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
l after insertFront(10) should be [  10  ]: [  10  ]
l is a list of 3 elements: [  1  2  3  ]
n.item() should be 1: 1
n.item() should be 2: 2
n.item() should be 2: 2
n.item() should be 4: 4
n.item() should be 3: 3
n.item() should be 6: 6
After doubling all elements of l: [  2  4  6  ]
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
n.item() should be 6: 6
n.item() should be 12: 12
n.item() should be 4: 4
n.item() should be 8: 8
n.item() should be 2: 2
n.item() should be 4: 4
After doubling all elements of l again: [  4  8  12  ]
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
Removing middle element (8) of l: 8
l is now: [  4  12  ]
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
Removing end element (12) of l: 12
l is now: [  4  ]
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.
Removing first element (4) of l: 4
l is now: [  ]
p.isValidNode() should be false: false
p.item() should throw an exception, and did.
p.setItem() should throw an exception, and did.
p.next() should throw an exception, and did.
p.prev() should throw an exception, and did.
p.insertBefore() should throw an exception, and did.
p.insertAfter() should throw an exception, and did.
p.remove() should throw an exception, and did.







评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
zzdsg 2016-8-11 23:28:13 | 只看该作者
全局:
花了一晚上时间做完了 开心
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

全局:
hw5 finished
更多图片 小图 大图
组图打开中,请稍候......

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
lizeyu023 2016-8-12 18:54:25 | 只看该作者
全局:
本帖最后由 lizeyu023 于 2016-8-12 19:00 编辑

hw5也完成了,part1基本上没费时间,直接从hw4复制粘贴
倒是part2卡了很久,首先是注意到了时间限制,this.cardinality() + s.cardinality(),如果调用insert依次插入s的元素则是this.cardinality() * s.cardinality()
后来受到merge sort的启发(lecture 29),最后还是达到了要求

其次就是在debug过程中总会有InvalidNodeException出现,原来是自己在循环判断的地方用的是i.item()!=null,因为item()的方法只能由ValidNode调用,所以后来改成了i.isValidNode就好了很多




评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
liuyijuner 2016-8-16 22:42:59 | 只看该作者
全局:





评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
minchen57 2016-8-25 03:19:21 | 只看该作者
全局:
交作业了,如下图。不过有一个点不太清楚,运行 javac Set.java。成功,但是有如下两行 Note,求大神指点


虽然不影响运行和结果,但是总感觉哪里不对。下面是作业结果:


其中第二部分用了楼上同学的空集testcode,自己又写了两三个set测试,均通过。




评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

🔗
evelynnn 2016-9-4 15:51:12 | 只看该作者
全局:
Done~ 还在摸索中

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

全局:


set那个用的是((Comparable)xxx).comparaTo(xxx)写的,全程烧脑,觉得要考虑的情况还蛮多
主要就是在最后一个节点是不能乱用next()的

评分

参与人数 1学分 +1 收起 理由
yingy4 + 1

查看全部评分

回复

使用道具 举报

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

本版积分规则

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