CS 36CWinter 2024 Homework 1

【Windows Server 2019】邮件服务器配置与管理——安装及配置Winmail服务器(上) 博文介绍了如何安装邮件服务器 Winmail,如何配置Winmail,包括运行服务器,Winmail管理工具介绍和域名配置。 阅读详情

CS 36CWinter 2024 Homework 1:
Linked Lists
This project has you writing a significant implementation of a Linked List. This assignment is
due on January 23rd at 1400 PST (6:00 pm Davis time). You must work on this assignment
individually. We have provided you a rich skeleton project in Homework1.zip available from
Canvas which includes a full Gradle and IntelliJ environment, a couple of non-trivial test
functions, and the LinkedList.ks and LinkedListTest.ks files you need to extend to
implement the project.
Expected Project Outcomes

  1. Implement the major Linked List functionality including appending on either end,
    insertion, accessing of arbitrary elements, iterations, and higher order procedures
  2. Implement a comprehensive test suite for your Linked List implementation
    Implementation and Grading
    You should implement the specified function in LinkedList.ks. These are:

LinkedListIterator.computeNext() : Unit
LinkedListCellIterator.computeNext() : Unit
LinkedList.append(item: T) : Unit
LinkedList.prepend(item: T) : Unit
LinkedList.get(index: Int) : T
LinkedList.set(index: Int, item: T) : Unit
LinkedList.insertAt(index: Int, item: T) : Unit
LinkedList.removeAt(index: Int, item: T) : T
LinkedList.indexOf(item: T): Int
10. LinkedList.fold(initial: R, operation: (R, T)-> R) : R
11. LinkedList.map(operation: (T)->R): LinkedList
12. LinkedList.mapInPlace(operation: (T)->T): LinkedList
13. LinkedList.filter(operation: (T)-> Boolean): LinkedList
14. LinkedList.filterInPlace(op: (T)-> Boolean): LinkedList
You should also implement test functions in LinkedListTest.ks for all these functions. For
grading on Gradescope you will submit both your LinkedList.ks and LinkListTest.ks
files. Your LinkedList.ks file will be combined with our own tests to grade your LinkedList
code, while your LinkedListTest.ks file will be combined with our own implementation of
the LinkedList to evaluate how good a job you did on testing.
This does mean that your LinkedListTest.ks file can only test the public API since it can’t
call any other functions in the LinkedList class you may write. If you want to test your own
internal functions as well create a separate test file.
The autograder will run both of your files, and you can submit as many times as you want, but
only one part of your grade will be available for you to examine: the grade for testing. The
grade for your code itself will be hidden until grades are released in the evening on the 26th of
January.
The testing grade is based on code coverage: For full credit your test code must call all the
above functions in our implementation, all tests must succeed, and your tests must execute
95% of the lines in our version (this is code coverage: a measure of how well a test suite is at
actually checking different options).
Useful Notes
IntelliJ supports running tests in an easy manner from the IDE, by simply selecting the tests as
the target you wish to run or debug. You can also run individual tests or all tests at once, and
the IDE shows on the left which tests passed.
Additionally there is an option to “run tests with coverage” in the more (…) menu next to where
you can select what to run. This will highlight all the code that is actually executed by your tests
with green or red depending on whether each line was run or not. We will be using the
command-line version of the same tool to see how comprehensive your tests are by running
them against our implementation and measuring the coverage.
You are strongly encouraged to do a “red->green” programming style. Make a few test cases
first, then code the corresponding code in your LinkedList class until your tests pass. One
thing that helps is you can (and indeed are encouraged to) use the autograder’s code coverage
test as an oracle as this will help make sure both that your tests are correct1 and
comprehensive.
The AbstractIterator class in Kotlin is particularly useful. All you need to do to implement
a complete iterator is inherit from AbstractIterator and implement the computeNext()
function. This function should find the next element that should be returned in the iteration and
call setNext(), or, if there are no more elements, call done(). The iterator operator in
LinkedList uses the LinkedListIterator, while the cellIterator() function uses the
LinkedListCellIterator. The latter is useful for functions like mapInPlace or any other
case where you want to iterate through the cells in the link list, not just the data.
mapInPlace() and filterInPlace() are in-place variants: map() and filter() both
return new LinkedList objects, while mapInPlace() and filterInPlace() modify the
existing LinkedList object.
Most of the functions can be linear time (O(n)), but there are exceptions: both prepend and
append should be constant time while get and set should both be constant time for both the
first element and the last element. The autograder will check to ensure these performance
goals are met. The iterators should be O(1) for each iteration, which means the total iteration
ends up being O(n).
1 If you believe that your test is reporting a failure due to a bug in our code submit a report by email with
the test case that demonstrates the problem. If indeed it is a bug in our reference code rather than your
test-case you will get 1 point towards the “Win A Pi” bug-finding contest

基于Simulink的自适应控制(Adaptive Control)电励磁同步电动机 目录基于Simulink的自适应控制(Adaptive Control)电励磁同步电动机项目实例1. 项目背景2. 系统架构2.1 电励磁同步电动机模型2.2 三相逆变器模型2.3 自适应控制器(Adaptive Controller)2.4 系统框图3. 模型设计3.1 创建Simulink模型3.2 自适应控制(Adaptive Control)设计3.3 仿真环境搭建4. 参数优化4.1 自动调优5. 实际应用案例5.1 工业驱动系统5.2 风力发电系统6. 结论进一步优化建议需求分析电励磁同步电动机 阅读详情

相关推荐

N32G003学习——第九章 第三节1 串口 发送

经过第九章前2节的学习,基础打下之后,开始敲代码。

qq_34525008的博客 1034

CS 36CWinter 2024 Homework 3

CS 36CWinter 2024 Homework 3

todcode的博客 324

c# U盘禁用---守护进程(插入,拔出,卸载等操作)

一、简介 传统的对U盘禁用,我们多采用修改注册表的方式,详情参考:https://blog.csdn.net/qq_25372599/article/details/79815407;本文将介绍一种其他的方式–后台守护程序。其原理非常简单:当守护程序检测到U盘的插入信号,我们自动卸载U盘,致使系统无法识别U盘,达到禁用U盘的效果。 二、程序设计 2.1 变量定义 strin...

星星之火燃亮码空 2846

CS 36CWinter 2024 Homework 2

CS 36CWinter 2024 Homework 2

todcode的博客 291

基于Ultralytic实现多路摄像头目标检测

基于Ultralytic实现多路摄像头目标检测前面的文章分享了单路摄像头画面的YOLO目标检测,这篇文章主要分享一下多路摄像头画面的实时YOLO目标检测。测试环境在Windows系统下进行。

qq_57674776的博客 941

hcaptcha-challenger:基于本地AI模型自动破解验证码的工程实践

验证码作为区分人类与机器的经典安全机制,其核心原理是通过图像识别、行为分析等交互式挑战来阻挡自动化程序。传统绕过方法依赖第三方打码平台或脚本,存在成本高、稳定性差的问题。随着多模态大语言模型和计算机视觉技术的发展,本地化AI求解成为新的技术方向,它通过集成YOLO、ResNet等模型,在本地完成图像语义理解,实现了高隐私、低成本、可进化的验证码自动化解决方案。这种范式尤其适用于需要大规模稳定处理网页交互的场景,如电商数据采集和社交媒体管理。hcaptcha-challenger项目正是这一理念的工程实践,它

weixin_42587866的博客 1025

给Agent写测试-工具调用的回归怎么保

本文提出“测行为不测文字”的三层测试防线,解决 Agent 工具调用回归难题:第一层工具单测(纯函数);第二层循环集成测,通过 mock 模型断言工具调用、参数与回填的正确性;第三层评测集,固定问答对对比行为快照。代码演示了最小可运行测试,强调断言行为而非模型输出,确保提示词改动可安全合并。

D_ENG_F的博客 211

简单概述人形机器人的“大脑、小脑”

原创 仲翔云人形机器人产业通2024年09月13日 19:41上海人形机器人的大脑和小脑是其控制系统的关键组成部分,它们模拟了人类大脑和小脑的功能,以实现复杂的运动控制和决策过程。

AI生成曾小健3 2069

Kotlin中级——Coroutine exceptions handling

当协程用作根协程时。

松仔Log的博客 224

sphincs+ Nist Round3文档中文译版(SPHINCS+ Submission to the NIST post-quantum project, v.3)

1. 引言 哈希基础签名方案最初是由Lamport [14]在1970年代后期作为一次性签名方案开发的,并由Merkle [16]扩展为多次签名方案。这些方案的安全性易于分析,并仅依赖于所使用的哈希函数的属性。然而,Merkle基于树的签名方案需要在密钥生成时就确定要进行签名的数量,且为了保持性能这个数字要小。最重要的是,该系统需要用户记住一个状态:这个状态包含一些信息以记住密钥已经进行了多少次签名。 在Lamport方案诞生后的40年里,产生了许多想法改进了哈希基础签名的性能、实用性和理论基础,最终XMS

dedanddwb的博客 394

【C++】【STL算法】数据窄化及代码安全性

本文系统探讨了C++工程中数据窄化(narrowing conversion)的隐患与解决方案。数据窄化指将高精度/大范围类型转换为低精度/小范围类型,虽语法合法但会导致静默精度损失。其危险性体现在:错误隐蔽、STL会放大问题、数值错误具有传播性。现代C++要求窄化必须显式声明,文中提出四种工程解决方案:显式转换、边界统一转换、范围检查转换和使用GSL工具。建议在系统边界集中处理窄化,保持计算链路类型一致性,并通过分层策略(建模用double,控制用float)确保数值稳定性。核心思想是让窄化成为清晰可控的

Double Galaxy 80

Kotlin——Shared mutable state and concurrency

当使用多个协程操作变量,且未进行同步时,并不能得到正确的值。

松仔Log的博客 335

69、SAP数据库归档重做日志备份策略与工具详解

本文详细解析了SAP数据库归档重做日志备份的重要性及策略,介绍了SAP提供的备份工具brarchive及其配置和使用方法,探讨了BRBACKUP与BRARCHIVE的联合运行、一致在线备份、备用数据库备份场景以及备份策略的综合应用与优化。此外,还分析了备份过程中常见问题的解决方法、备份监控与评估流程、与第三方备份解决方案的集成方式,以及未来备份技术的发展趋势和应对策略。通过合理运用这些策略和工具,可以有效保障SAP数据库的安全性和可恢复性。

peace的博客 135

Android 开发入门实践(二):Kotlin 空安全,从可空类型到安全访问

延续 NewsApp 项目中的新闻标题练习,记录 Kotlin 安全调用。

Easyhood的博客 286

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Android 开发入门实践(五):从 Kotlin 类与对象到新闻数据模型

本文记录了在NewsApp项目中学习Kotlin类与对象的全过程:从声明空类、创建对象,到添加属性、使用构造函数与默认参数,最终通过data class和copy()实现新闻数据模型的构建。重点区分了类与对象、参数与属性的概念,掌握了修改原对象与复制新对象的区别,并将新闻列表接入Jetpack Compose显示标题,深化了对数据封装与可变性的理解。

Easyhood的博客 224

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

kotlin中闭包特性

Kotlin 闭包允许函数捕获并修改外部作用域的变量,通过 Ref 包装类实现,比 Java 的“仅读取 final 变量”更灵活。闭包是函数式编程(如柯里化、高阶函数)的基础,但修改捕获变量不保证线程安全,需手动同步(如 Mutex、Atomic)。Java 限制修改捕获变量以避免并发陷阱,而 Kotlin 将选择权交予开发者:语法自由,责任自担。

YB1375的专栏 215

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Kotlin中级——Select expression

select的onReceive允许从2个channel中获取值。

松仔Log的博客 260

Gson + Kotlin 数据类的空安全陷阱:一次线上 NPE 崩溃的完整分析与修复

服务端返回 {"provinceName": null, ...}│▼Gson 反射赋值,绕过主构造函数和空检查│▼data.provinceName 实际是 null(但类型仍标记为非空 String)│▼主线程 lambda 拿着这个"假的非空值"传给非空参数│▼Intrinsics.checkNotNullParameter 抛出 NPE,主线程崩溃项目内容崩溃现象根本原因Gson 反射赋值绕过 Kotlin 构造函数与空检查,服务端返回显式null。

学习的最佳方式,就是把它写下来! 201

Kotlin与Java虚拟机四:函数

Kotlin 中函数是“一等公民”,使用 fun 声明,支持表达式函数体、默认参数、命名参数和可变参数(vararg)。函数可位于顶层(编译为静态方法)、局部或类中。无返回值时类型为 Unit,尾递归优化可避免栈溢出。本章还介绍了函数的灵活性与可读性提升特性,为后续高阶函数打下基础。

canfeit的专栏 177

Kotlin与Java虚拟机三:控制流

Kotlin 控制流以表达式为核心,if 和 when 均可返回值,取代了 Java 的语句形式。when 功能强大,支持多值、区间、类型判断及穷尽性检查,提升安全性。区间与 for 循环结合,简洁遍历集合;break/continue 可配合标签跳出嵌套循环。Lambda 中的 return 默认非局部返回,需用 return@标签 控制行为。整体设计更安全、简洁。

canfeit的专栏 345

Kotlin flow 详解

/ 接收launch {// 发送launch {可以看到创建SharedFlow时,没有像创建冷流flow一样传入一个block的函数参数。自然调用collect也没有可以重新运行的代码。

weixin_45444971的博客 223

Android 开发入门实践(四):Kotlin 列表的安全读取、增删改与筛选转换

本章学习Kotlin列表操作,重点掌握getOrNull安全取值、isEmpty/isNotEmpty判断空列表、MutableList可变性及add、remove、removeAt、替换元素等操作。通过日志验证,区分原列表修改与新列表创建,明确filter、map、find等函数返回类型与作用。强调下标越界处理、重复元素删除逻辑及val与可变性的关系,巩固列表操作的准确理解。

Easyhood的博客 166

Android 开发入门实践(三):理解 Kotlin 列表下标、size 与 lastIndex

Log . d(TAG , "最后一条新闻的下标: $ lastNewsIndex ")lastIndex的 I 大写,后面同样不加圆括号。变量名中的 N、I 都大写。它返回的是一个下标,不是最后一条新闻的文字,也不是新闻总数。表达式表示什么结果元素数量10最后一个下标9下标9对应的元素本文示例中是"第十条新闻"表格最后一行根据本文复习数据得出;前两行的10和9也与当时两节课的运行反馈一致。

Easyhood的博客 223

Go1.27升后Errorf指针%w怎么改

Go1.27起printf vet会报告用%w包装*E(E已实现error);应改传值型error,并用errors.Is/As回归验收。

Amax3747的博客 448

Android 开发入门实践(一):用 Kotlin 和 Jetpack Compose 实现新闻列表

以 NewsApp 新闻列表项目为例,记录 Kotlin 变量、条件判断、循环、函数和可空类型的基础练习,以及 Jetpack Compose 中列表、卡片、图片、图文布局与点击日志的实现过程。

Easyhood的博客 166

【维克】均值回归型CTA:期货的“弹簧效应“

老李犯的错,是把"涨多了"当成"过头了"。但螺纹钢从1600涨到3000,可能只是从"严重亏损"回到"合理利润",根本没过头。讲清楚商品期货的"弹簧"到底长什么样、用什么指标判断偏离、什么场景下均值回归有效,以及——开平仓和止损该怎么设计。当价格低,供给减少、需求增加,形成短缺,价格上涨。当某个品种库存处于历史高位,同时生产利润也很高(价格远高于成本),说明"供大于求 + 暴利",价格下行的压力很大。老李看空,理由是"涨太多了,肯定要跌"。因为均值回归的"诱惑"太大了——价格越偏离,你越觉得"该回归了"。

weixin_42332217的博客 477
上一篇: 江苏大学京江学院操作系统java
下一篇: COMP9021 Assignment 2
todcode
博客等级 码龄7年 359粉丝 108原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值