首页 > 其他分享 >03 - collections

03 - collections

时间:2022-10-22 17:56:59浏览次数:33  
标签:03 About Lexicon word type Vector collections data

Collections

  • A collection class (also called an abstract data type or container class) is a data type used to store and organize data in some form.
    These are things like arrays, lists, maps, dictionaries, etc.

We start exploring collections and how to use them appropriately.
Later, we’ll analyze their efficiencies. For now, let’s just focus on how to use them.

Linear

Vector

About

  • A Vector is a collection class representing a list of things.
  • It’s similar to Java's ArrayList, JavaScript’s arrays, and Python’s lists.
  • To make a Vector, use this syntax: Vector <type> name;
  • All elements of a Vector have to have the same type. You specify that type by placing it in after the word Vector.

Stacks

About

  • A Stack is a data structure representing a stack of things.
  • Objects can be pushed on top of the stack or popped from the top of the stack.

Usage

Balancing Parentheses

Queues

About

  • A Queue is a data structure representing a waiting line.
  • Objects can be enqueued to the back of the line or dequeued from the front of the line.
  • No other objects in the queue are visible.

Not Linear

Lexicon

  • Storing a collection of words.

  • A Lexicon is a container that stores a collection of words.

  • The Lexicon is designed to answer the following question efficiently:

  • Given a word, is it contained in the Lexicon?

  • The Lexicon does not support access by index. You can’t, for example, ask what the 137th English word is.

  • However, it does support questions of the form “does this word exist?” or “do any words have this as a prefix?”

Tautonyms
A tautonym is a word formed by repeating the same string twice.
For example: murmur, couscous, papa, etc.

Set

  • Storing a group of whatever you’d like.

About

img

标签:03,About,Lexicon,word,type,Vector,collections,data
From: https://www.cnblogs.com/louis614/p/cs106b_03.html

相关文章

  • 通过地址查看nginx管理下的视频403
        最近服务器上要保存一些视频,上传成功后通过nginx在公网查看,发现nginx报403,。查询资料后发现是nginx对文件没有权限导致的,对指定视频配置读取权限后依然403,进......
  • Go常见错误总结1:'test' redeclared in this package
    Go常见错误总结1:'test'redeclaredinthispackage问题:'test'redeclaredinthispackage产生原因:变量名或方法名重名问题导致的,你这个变量和其他.go文件里面方......
  • 单调队列优化dp(1)(P2034 选择数字)
    参考算法学习笔记(66):单调队列-知乎(zhihu.com)题目描述给定一行n个非负整数a[1]..a[n]。现在你可以选择其中若干个数,但不能有超过k个连续的数字被选择。你的任务是......
  • SpringCloud-03 Netflix Ribbon学习笔记
    @​​TOC​​一、Ribbon简介1、什么是Ribbon?SpringCloudRibbon是基于NetflixRibbon实现的一套客户端负载均衡的工具,它可以很好地控制HTTP和TCP客户端的行为。简单的......
  • 'gbk' codec can't encode character '\xa0' XXX解决方法
    在运行py文件时,出现“UnicodeEncodeError:‘gbk’codeccan’tencodecharacter‘\xa0’inpositionXXX”,让人摸不着头脑。注意这三个方面,一般都能解决。1.程序......
  • 江苏工匠杯unseping(反序列化+Linux命令执行{$(printf '\154\163')})
    <?phphighlight_file(__FILE__);classease{private$method;private$args;function__construct($method,$args){$this->method=$m......
  • 「题解」洛谷 P8529 [Ynoi2003] 赫露艾斯塔
    构造半平面莫队?/jk注意到对于一个半平面的直线,通过平移和旋转经过的点数,一定大于等于它们的对称差,因为对称差中的点会被经过奇数次,不在对称差中的点会被经过偶数次。那么......
  • 103-windows 安装kafka
    下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/2)下载后解压到一个目录:eg:D:\Java\Tool\zookeeper-3.4.103)在zookeeper-3.4.10目录下,新建文件夹,并命名(......
  • 高版本 jenkins 报403 需关闭跨站请求伪造保护(CSRF)
    根据官网描述,Jenkins版本自2.204.6以来的重大变更有:删除禁用CSRF保护的功能。从较旧版本的Jenkins升级的实例将启用CSRF保护和设置默认的发行者,如果之前被禁用。方......
  • day03-2-拓展
    满汉楼035.拓展_多表查询前面都是对单表进行操作思考一个问题:如果多表查询怎么处理?例如,查看账单时,希望现实菜品名称查询的结果从上图变为下图:方案一由多张表组合......