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

[公开课] Berkeley CS 61B Data Structures(in Java) Homework7 加分+讨论帖

 
🔗
Wei Zhang 2017-5-21 08:06:02 | 只看该作者
全局:
本帖最后由 Wei Zhang 于 2017-5-21 08:11 编辑

重复的发了一个帖子,不知道怎么删。
更多图片 小图 大图
组图打开中,请稍候......
回复

使用道具 举报

🔗
dengzeyu147 2017-5-23 14:41:34 | 只看该作者
全局:
好难得啊啊   
AppledeMacBook-Pro-5:hw7 apple$ javac -g dict/*.java
AppledeMacBook-Pro-5:hw7 apple$ java dict.Tree234

Inserting 84.
84

Inserting 7.
7 84

Inserting 22.
7 22 84

Inserting 95.
(7)22(84 95)

Inserting 50.
(7)22(50 84 95)

Inserting 11.
(7 11)22(50 84 95)

Inserting 37.
(7 11)22(37 50)84(95)

Inserting 60.
(7 11)22(37 50 60)84(95)

Inserting 1.
(1 7 11)22(37 50 60)84(95)

Inserting 23.
(1 7 11)22(23 37)50(60)84(95)

Inserting 16.
((1)7(11 16)22(23 37))50((60)84(95))

Inserting 100.
((1)7(11 16)22(23 37))50((60)84(95 100))

Inserting 28.
((1)7(11 16)22(23 28 37))50((60)84(95 100))

Inserting 86.
((1)7(11 16)22(23 28 37))50((60)84(86 95 100))

Inserting 49.
((1)7(11 16)22(23)28(37 49))50((60)84(86 95 100))

Inserting 81.
((1)7(11 16)22(23)28(37 49))50((60 81)84(86 95 100))

Inserting 51.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86 95 100))

Inserting 99.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86)95(99 100))

Inserting 75.
((1)7(11 16)22(23)28(37 49))50((51)60(75 81)84(86)95(99 100))

Inserting 66.
((1)7(11 16)22(23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 4.
((1 4)7(11 16))22((23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 80.
(((1 4)7(11 16))22((23)28(37 49)))50(((51)60(66)75(80 81))84((86)95(99 100)))

Final tree:
               100
               99
          95
               86
     84
               81
               80
          75
               66
          60
               51
50
               49
               37
          28
               23
     22
               16
               11
          7
               4
               1
AppledeMacBook-Pro-5:hw7 apple$
回复

使用道具 举报

🔗
呜哇声声 2017-5-30 11:25:08 | 只看该作者
全局:
交作业~

Inserting 84.
84

Inserting 7.
7 84

Inserting 22.
7 22 84

Inserting 95.
(7)22(84 95)

Inserting 50.
(7)22(50 84 95)

Inserting 11.
(7 11)22(50 84 95)

Inserting 37.
(7 11)22(37 50)84(95)

Inserting 60.
(7 11)22(37 50 60)84(95)

Inserting 1.
(1 7 11)22(37 50 60)84(95)

Inserting 23.
(1 7 11)22(23 37)50(60)84(95)

Inserting 16.
((1)7(11 16)22(23 37))50((60)84(95))

Inserting 100.
((1)7(11 16)22(23 37))50((60)84(95 100))

Inserting 28.
((1)7(11 16)22(23 28 37))50((60)84(95 100))

Inserting 86.
((1)7(11 16)22(23 28 37))50((60)84(86 95 100))

Inserting 49.
((1)7(11 16)22(23)28(37 49))50((60)84(86 95 100))

Inserting 81.
((1)7(11 16)22(23)28(37 49))50((60 81)84(86 95 100))

Inserting 51.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86 95 100))

Inserting 99.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86)95(99 100))

Inserting 75.
((1)7(11 16)22(23)28(37 49))50((51)60(75 81)84(86)95(99 100))

Inserting 66.
((1)7(11 16)22(23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 4.
((1 4)7(11 16))22((23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 80.
(((1 4)7(11 16))22((23)28(37 49)))50(((51)60(66)75(80 81))84((86)95(99 100)))

Final tree:
               100
               99
          95
               86
     84
               81
               80
          75
               66
          60
               51
50
               49
               37
          28
               23
     22
               16
               11
          7
               4
               1
回复

使用道具 举报

🔗
NancyWang 2017-6-1 22:12:34 | 只看该作者
本楼:
全局:
更多图片 小图 大图
组图打开中,请稍候......
回复

使用道具 举报

🔗
liniua 2017-6-30 09:13:32 | 只看该作者
全局:
Inserting 84.
84

Inserting 7.
7 84

Inserting 22.
7 22 84

Inserting 95.
(7)22(84 95)

Inserting 50.
(7)22(50 84 95)

Inserting 11.
(7 11)22(50 84 95)

Inserting 37.
(7 11)22(37 50)84(95)

Inserting 60.
(7 11)22(37 50 60)84(95)

Inserting 1.
(1 7 11)22(37 50 60)84(95)

Inserting 23.
(1 7 11)22(23 37)50(60)84(95)

Inserting 16.
((1)7(11 16)22(23 37))50((60)84(95))

Inserting 100.
((1)7(11 16)22(23 37))50((60)84(95 100))

Inserting 28.
((1)7(11 16)22(23 28 37))50((60)84(95 100))

Inserting 86.
((1)7(11 16)22(23 28 37))50((60)84(86 95 100))

Inserting 49.
((1)7(11 16)22(23)28(37 49))50((60)84(86 95 100))

Inserting 81.
((1)7(11 16)22(23)28(37 49))50((60 81)84(86 95 100))

Inserting 51.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86 95 100))

Inserting 99.
((1)7(11 16)22(23)28(37 49))50((51 60 81)84(86)95(99 100))

Inserting 75.
((1)7(11 16)22(23)28(37 49))50((51)60(75 81)84(86)95(99 100))

Inserting 66.
((1)7(11 16)22(23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 4.
((1 4)7(11 16))22((23)28(37 49))50((51)60(66 75 81))84((86)95(99 100))

Inserting 80.
(((1 4)7(11 16))22((23)28(37 49)))50(((51)60(66)75(80 81))84((86)95(99 100)))

Final tree:
               100
               99
          95
               86
     84
               81
               80
          75
               66
          60
               51
50
               49
               37
          28
               23
     22
               16
               11
          7
               4
               1

Process finished with exit code 0
回复

使用道具 举报

🔗
SaltSprayAir 2017-7-5 00:22:04 | 只看该作者
全局:
就是繁琐,没有难度,耐心分析耐心debug总能做出来

Screen Shot 2017-07-04 at 09.19.46.png (85.08 KB, 下载次数: 0)

后半部分运行结果截图

后半部分运行结果截图
回复

使用道具 举报

头像被屏蔽
🔗
老毒物 2017-7-22 23:39:25 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

🔗
yywwd 2017-8-3 22:38:00 | 只看该作者
全局:
打卡!搞来搞去 做的头晕。。。
回复

使用道具 举报

🔗
yagamy 2017-8-9 09:54:59 | 只看该作者
全局:
作业写了两个多小时,但是debug了将近3个小时…… 确实没有仔细考虑,只把新split的node的child定义了,没有把child的parent指向新node。
更多图片 小图 大图
组图打开中,请稍候......
回复

使用道具 举报

🔗
edwardpei 2017-9-7 12:07:56 | 只看该作者
全局:
C:\Users\Kuo Pei\Desktop\Homework and Projects\hw7\screenShotOfResult\Untitled picture.png
终于做完了,感觉这个还是挺耗时间的,由于题中的node没有使用数组,所以每种节点情况都得分开写,开头那里newRoot也是单独写的,感觉这样浪费了好多时间,准备再去查查其他人写得更好的实现方法/
不过,需要注意的一点是:1、处理一切这种双向节点链接的问题时,都应该注意把两头连在一起,不能只连一端;
2、在开始编码之前,手动从头实现一下数据结构,有利于深入理解,梳理各个步骤;
3、复杂的数据结构实现时,依照top-down的设计模式,先写好最顶层接口,再逐层细分任务;
4、ADT的invariants是由fields与methods共同维护的;类似child n<key n+1 <child n+1这种关系:在node的class中仅需保证每个节点是两组升序排列的key和child,而insert() method人为保证了两个序列元素之间的大小关系正确。在本题234树中,method的作用更大一些。
回复

使用道具 举报

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

本版积分规则

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