Programming Abstractions in C阅读笔记:p331-p337

news2024/9/29 19:18:49

《Programming Abstractions in C》学习第79天,p331-p337,总计7页。

一、技术总结

/*
 * File: stack.h
 * -------------
 * This interface defines an abstraction for stacks. In any
 * single application that uses this interface, the values in
 * the stack are constrained to a single type, although it
 * is easy to change that type by changing the definition of
 * stackElementT in this interface.
 */

#ifndef _stack_h
#define _stack_h

#include "genlib.h"

/*
 * Type: stackElementT
 * -------------------
 * The type stackElementT is used in this interface to indicate
 * the type of values that can be stored in the stack. Here the
 * stack is used to store values of type double, but that can
 * be changed by editing this definition line.
 */

typedef double stackElementT;

/*
 * Type: stackADT
 * --------------
 * The type stackADT represents the abstract typed used to store
 * the elements that have been pushed. Because stackADT is
 * defined only as a pointer to a concrete structure that is not
 * itself defined in the interface, clients have no access to
 * the underlying fields.
 */

typedef struct stackCDT *stackADT;

/*
 * Function: NewStack
 * Usage: stack = NewStack();
 * --------------------------
 * This function allocates and returns a new stack, which is
 * initially empty.
 */

stackADT NewStack(void);

/*
 * Function: FreeStack
 * Usage: FreeStack(stack);
 * ------------------------
 * This function free the storage associated with the stack.
 */

void FreeStack(stackADT stack);

/*
 * Function: Push
 * Usage: Push(stack, element);
 * ----------------------------
 * This function pushes the specified element onto the stack;
 */
void Push(stackADT stack, stackElementT element);


/*
 * Function: Pop
 * Usage: element = Pop(stack);
 * -----------------------------
 * This function pops the top element from the stack and returns
 * that value. The first value popped is always the last one
 * that was pushed. If the stack is empty when Pop is called,
 * the function calls Error with an appropriate message.
 */

stackElementT Pop(stackADT stack);


/*
 * Function: StackIsEmpty, StackIsFull
 * Usage: if (StackIsEmpty(stack)) ...
 *        if (StackIsFull(stack)) ...
 * ---------------------------------------
 * This function test whether the stack is empty or full.
 */

bool StackIsEmpty(stackADT stack);
bool StackIsFull(stackADT stack);

/*
 * Function: StackDepth
 * Usage: depth = StackDepth(stack);
 * ---------------------------------
 * This function returns the number of elements currently pushed
 * on the stack.
 */
int StackDepth(stackADT stack);


/*
 * Function: GetStackElement
 * Usage: element = GetStackElement(stack, index);
 * -----------------------------------------------
 * This function returns the element at the specified index in
 * the stack, where the top of the stack is defined as index 0.
 * For example, calling GetStackElement(stack, 0) returns the top
 * element on the stack without removing it. If the caller tries
 * to select an out-of-range element, GetStackElement calls Error.
 * Note: This function is not a fundamental stack operation and
 * is instead provided principally to facilitate debugging.
 */
stackElementT  GetStackElement(stackADT stack, int index);

#endif

二、英语总结

1.polymorphism是什么意思?

答:

(1)polymorphous > polymorph > polymorphism

(2)polymorphous: poly"many" + morphē “shape, form,”。adj. have various forms。

(3)polymorphism: capability of existing in different forms(多态性)。

p332, the ability to apply the same function to objects of different types called polymorhpism。

2.overhead用法总结

答:

(1)n. the regular and necessary costs(开销)。p332, In some cases, however, forcing the clients to use pointer as data values imposes an unacceptable level of overhead.

平时大多做副词用,也可以做名词。

3.compromise是什么意思?

答:com-(together) + promise,c/u. a joint promise to abide by an arbiter’s decision(妥协)。 abide by sth: to accept or obey an aggrement。

4.as far as sth is concerned是什么意思?

答:If we are discussing or thinking about a particular thing(就…而言)。

5.relinquish是什么意思?

答:vt. to give up sth such as responsibility or claim(放弃,舍弃)。p335, Thus, in addition to the function NewStack, you need a symmetric funciton FreeStack, that takes a buffer and relinquishes any dynamically allocated storage it contains。

三、其它

并不是每一篇文章都是有意义的,这只是学习过程的一个记录。

四、参考资料

1. 编程

(1)Eric S.Roberts,《Programming Abstractions in C》:https://book.douban.com/subject/2003414

2. 英语

(1)Etymology Dictionary:https://www.etymonline.com

(2) Cambridage Dictionary:https://dictionary.cambridge.org

在这里插入图片描述

欢迎搜索及关注:编程人(a_codists)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1541026.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

2024/3/24 LED点阵屏

显示原理: 类似矩阵键盘,逐行or逐列扫描 74HC595是串行 寄存器 感觉就是三转八寄存器 并行:同时输出;串行:一位一位输出 先配置74HC595,重新进行位声明 sbit RCKP3^5; //RCLK sbit SCKP3^6; …

ai问答机器人是什么?介绍这几款实用ai问答机器人

ai问答机器人是什么?随着人工智能技术的飞速发展,AI问答机器人已成为我们生活中不可或缺的一部分。它们能够智能地解答各种问题,提供便捷的服务,极大地提升了用户体验。本文将带你了解AI问答机器人的基本概念,并介绍几…

30-函数(上)

30-1 函数是什么 在计算机科学中,子程序是一个大型程序中的某部分代码,由一个或多个语句块组成。它负责完成某项特定任务,而且相较于其他代码,具备相对的独立性。 一般会有输入参数并有返回值,提供对过程的封装和细节…

jenkins配置源码管理的git地址时,怎么使用不了 credential凭证信息

前提 Jenkins使用docker部署 问题 (在jenlins中设置凭证的方式)在Jenkins的任务重配置Git地址,并且设置了git凭证,但是验证不通过,报错; 无法连接仓库:Command "git ls-remote -h -- http://192.1XX.0.98:X02/…

梅林生态第一个Defi借贷协议零撸教程

简介:Avalon Finance是第一个基于Merlin Chain的去中心化借贷协议。它包括三个关键组成部分:超额抵押借贷、与借贷相关的衍生品交易和基于借贷的算法稳定币。 相关概念:梅林生态、Defi 融资信息:项目于3月15日完成种子轮融资&am…

IntelliJ IDEA集成git配置账号密码

1 背景说明 刚使用IDEA,本地也安装Git,在提交和拉取代码的时候,总提示登录框,而且登录框还不能输入账号密码,只能输入登录Token。如下: 从而无法正常使用IDEA的Git功能,很苦恼。 2 解决方法 2.1 安装Git 进入官网地址 https://git-scm.com/,点击下载: 浏览器直接…

数据结构——栈和队列的表示与实现详解

目录 1.栈的定义与特点 2.队列的定义与特点 3.案例引入 4.栈的表示和操作的实现 1.顺序栈的表示 代码示例: 2.顺序栈的初始化 代码示例: 3.判断栈是否为空 代码示例: 4.求顺序栈长度 代码示例: 5.清空顺序栈 …

官宣|阿里巴巴捐赠的 Flink CDC 项目正式加入 Apache 基金会

摘要:本文整理自阿里云开源大数据平台徐榜江 (雪尽),关于阿里巴巴捐赠的 Flink CDC 项目正式加入 Apache 基金会,内容主要分为以下四部分: 1、Flink CDC 新仓库,新流程 2、Flink CDC 新定位,新玩法 3、Flin…

taro框架之taro-ui中AtSwipeAction的使用

题记&#xff1a;所需效果&#xff1a;滑动删除 工作进程 官网文档代码 <AtSwipeAction options{[{text: 取消,style: {backgroundColor: #6190E8}},{text: 确认,style: {backgroundColor: #FF4949}} ]}><View classNamenormal>AtSwipeAction 一般使用场景</…

Vue 3 里的 onMounted 怎么用?

疑问 最近&#xff0c;一直在学习 Vue 3&#xff0c;此前我不懂前端&#xff0c;也没写过 Vue 2&#xff0c;所以是从 0 开始学习 Vue 3 的。很多对普通人不是疑问的&#xff0c;在我这里也会不太清楚。 我在写项目的时候&#xff0c;常见的一种场景是这样的&#xff1a;页面…

Excel通过下拉菜单,显示不同图片

背景&#xff1a;有的时候需要通过更改下拉菜单来改变对应的 值/ 图片。 如果是数值的话就是我们常常用的Vlookup&#xff0c;这个可以很简单的实现这个功能。&#xff08;这个如果不知道请自行百度&#xff09; 但是如果是图片呢&#xff1f;这个就不常见了&#xff0c;那么…

41 物体检测和目标检测数据集【李沐动手学深度学习v2课程笔记】

目录 1. 物体检测 2. 边缘框实现 3.数据集 4. 小结 1. 物体检测 2. 边缘框实现 %matplotlib inline import torch from d2l import torch as d2ld2l.set_figsize() img d2l.plt.imread(../img/catdog.jpg) d2l.plt.imshow(img);#save def box_corner_to_center(boxes):&q…

企业计算机服务器中了mkp勒索病毒怎么办,mkp勒索病毒解密流程步骤

在网络技术飞速发展的今天&#xff0c;越来越多的企业走向了数字化办公模式&#xff0c;网络为企业的生产运营提高了效率&#xff0c;为企业带来了极大便利&#xff0c;但网络是一把双刃剑&#xff0c;在为人们提供便利的同时也会带来数据安全问题&#xff0c;网络数据安全一直…

NFS网络文件系统

目录 简介 案例 配置autofs自动挂载 客户端配置autofs 简介 NFS&#xff08;Network File System&#xff0c;网络文件系统&#xff09;是FreeBSD支持的文件系统中的一种&#xff0c;它允许网络中的计算机&#xff08;不同的计算机、不同的操作系统&#xff09;之间通过TCP/I…

每日一题 --- 螺旋矩阵 II[力扣][Go]

螺旋矩阵 II 题目&#xff1a;59. 螺旋矩阵 II - 力扣&#xff08;LeetCode&#xff09; 给你一个正整数 n &#xff0c;生成一个包含 1 到 n2 所有元素&#xff0c;且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 示例 1&#xff1a; 输入&#xff1a;n 3 输出…

vulhub打靶记录——cengbox

文章目录 主机发现端口扫描搜索SSH EXPweb渗透nikto扫描目录扫描登录网站后台提权 主机发现 使用nmap扫描局域网内存活的主机&#xff0c;命令如下&#xff1a; nmap -sP 192.168.56.0/24192.168.56.1&#xff1a;主机IP&#xff1b;192.168.56.100&#xff1a;DHCP服务器IP&…

SpringCloud-Gateway服务网关

一、网关介绍 1. 为什么需要网关 Gateway网关是我们服务的守门神&#xff0c;所有微服务的统一入口。 网关的核心功能特性&#xff1a; 请求路由 权限控制 限流 架构图&#xff1a; 权限控制&#xff1a;网关作为微服务入口&#xff0c;需要校验用户是是否有请求资格&am…

windows 系统下(nacos1.x) nacos-1.1.3 链接数据库 mysql8.0 出错分析

** windows 系统下&#xff08;nacos1.x&#xff09; nacos-1.1.3 链接数据库 mysql8.0 出错分析 ** 1、首先以下方法亲测无效&#xff1a; 1&#xff09;需要在数据库 URL 链接配置信息中 添加 allowPublicKeyRetrievaltrue 无效 db.url.0**&allowPublicKeyRetrievalt…

基于python+vue城市交通管理系统的设计与实现flask-django-php-nodejs

此系统设计主要采用的是python语言来进行开发&#xff0c;采用django/flask框架技术&#xff0c;框架分为三层&#xff0c;分别是控制层Controller&#xff0c;业务处理层Service&#xff0c;持久层dao&#xff0c;能够采用多层次管理开发&#xff0c;对于各个模块设计制作有一…

正弦实时数据库(SinRTDB)简介

正弦实时数据库是长沙巨松软件科技有限公司为了解决工业传感器产生的海量数值型数据的存储、计算等需求而研发的产品。广泛应用于电力、冶金、石油、化工、燃气等多个领域。 正弦实时数据库的主要特点如下&#xff1a; 性能 单机支持管理一百万标签点。单机支持并发用户数超…