- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
正如标题所说,我如何用霍尔三元组验证下面的功能?我阅读了有关它的各种讲座,但我不知道该怎么做。
int uguaglianza_insiemi(elem_lista_t *insieme_A,
elem_lista_t *insieme_B)
{
int esito;
if ((insieme_A == NULL) &&
(insieme_B == NULL))
esito = 1;
else if (insieme_A == NULL ||
insieme_B == NULL)
esito = 0;
else if (insieme_A->valore != insieme_B->valore)
esito = 0;
else esito = uguaglianza_insiemi(insieme_A->succ_p,
insieme_B->succ_p);
return (esito);
}
最佳答案
为了避免在评论中进行冗长的讨论,我将尝试编写一些前置条件和后置条件。
由于无法在函数内部测试是否使用指向有效列表对象的指针来调用它,因此它落在父/调用者身上:
// The following function must be called with pointers that are either null
// or point to valid list elements. The lists must be correct (no malloc bugs etc).
// The compiler must have checked that it is called with pointers to the proper types,
// as C has no typeof operator.
//
int uguaglianza_insiemi(elem_lista_t *insieme_A,
elem_lista_t *insieme_B)
{
int esito;
if ((insieme_A == NULL) &&
(insieme_B == NULL))
esito = 1; // both pointers are null: equal
// not both pointes are null
else if (insieme_A == NULL ||
insieme_B == NULL)
esito = 0; // not both pointers are null, but one is: not equal
// neither pointer is null and so they may be dereferenced
else if (insieme_A->valore != insieme_B->valore)
esito = 0; // neither pointer is null, but their element values aer not equal: not equal
// the function can be called recursively now because its precondition has been met,
// that both successor pointers are null or point to valid list elements (induction).
else esito = uguaglianza_insiemi(insieme_A->succ_p,
insieme_B->succ_p);
// the post condition is that esito reflects equality of both (partial) lists
return (esito);
}
我希望这是您和您的教授可以合作的东西。
{P}: The function must be called with pointers that are either null or point to valid list elements.
C:
uguaglianza_insiemi( *A, *B)
{Q}: function result reflects equality of the lists
在函数内部,这继续使用组合规则的 if
语句。
关于c - 如何用 Hoare Triple 验证该功能?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56327974/
嗨,大家好,我有 java 代码,它为我生成三重加密代码,现在我尝试使用 crypto-js 在 javascript 上使用它,但这两个代码提供了不同的 key ,我不知道为什么以及如何获得相同的
我想尽可能简洁地(但清楚地)转换 List到 Triple, List, List> . 例如,假设执行转换的方法称为 turnOver ,我希望: val matches = listOf( T
这个问题已经有答案了: What is the JavaScript >>> operator and how do you use it? (7 个回答) Strange javascript op
含糊不清的问题: 1:为什么几乎 100% 的应用程序开发人员、应用程序开发社区和文献(书籍、教程等)都认为您想使用关系数据库或键值存储来表达数据? 2:为什么不是每个人都使用“三重”数据结构?
我正在准备一个Docker镜像来教我的学生链接数据的基础知识。我希望他们实际准备适当的RDF并模拟将其作为链接数据发布到Web上的过程,因此我准备了一个Docker镜像,其中包括: 三重存储:Blaz
我从服务器人员那里得到了这段代码: public string Encryption(string PlainText) { string key = "twelve_digit_key"; Trip
有一段时间我对此感到相当困惑,但我终于学会了如何使用 Raptor 和 Redland Python Extensions 解析大型 N-Triples RDF 存储 (.nt)。 一个常见的例子是执
我有这个 CSS: border: 2px solid #00ff60; outline: 1px solid #000; outline-offset: 0px; 产生这个: 我怎样才能调整它,让它
我想解析一个 n-triple 形式的 RDF 文件。 我可以编写自己的解析器,但我宁愿使用库,为此目的,Jena 似乎不必要地复杂化(或者至少我看不到他们的文档解释如何以合理的方式读取 n-trip
尝试运行现有的 meteor 项目时收到错误消息。 $meteor => Started proxy. => Started MongoDB. => Errors prevented startup:
我正在 .Net 上开发一个 mvc 应用程序,以保护我的敏感信息,例如 web.config 中的信息,我有两个使用 Triple DES 加密和解密信息的函数,但是我是新手在 friend 的帮助
我在 Protege 中创建了一个本体。现在为了让我的应用程序具有更好的可扩展性,我喜欢将 OWL 文件转换为三重存储并查询存储。 如何将 owl 文件转换为三重存储? 最佳答案 严格来说,OWL 不
我需要知道Triple DES算法适用的填充模式是什么,AI_PKCS_PADDING 是适用于 Triple DES 的填充模式吗? 最佳答案 根据Java Cipher API : Every i
我在互联网上搜索了 Java 的 Triple Des 算法实现。 我找到了很多解决方案并选择了一个(对我来说有更好文档的那个)。我测试过,工作正常。 然后,我搜索了 Java 的 AES 算法实现。
我打算在我的一个项目中使用 TripleDES。我正在做一些实验以适应它。我知道三重 DES 的 block 大小是 8 个字节,所以我假设如果提供 8 个字节的数据,我应该得到 8 个字节的加密数据
正如标题所说,我如何用霍尔三元组验证下面的功能?我阅读了有关它的各种讲座,但我不知道该怎么做。 int uguaglianza_insiemi(elem_lista_t *insieme_A,
我正在研究一个代码挑战问题——“找到幸运的三元组”。 “幸运三元组”定义为“在列表 lst 中,对于像 (lst[i], lst[j], lst[k]) where i < j < k 这样的三元组的
我正在用 C# 解密消息,此消息使用以下代码在 PHP 中加密:- public function __construct($sEncryptionKey) { $this->link = m
我正在尝试查找本地系统分配给箭头键的值,特别是在 Python 中。我正在使用以下脚本来执行此操作: import sys,tty,termios class _Getch: de
我想用前缀来表示这个nt文件: . "a" . "b" . "c" . 我写入一个新的nt文件是: @prefix sp: . . "a" . "b" . "c"
我是一名优秀的程序员,十分优秀!