type
status
date
slug
summary
tags
category
icon
password
Property
Jul 24, 2023 10:25 AM
notion image
Announcement
notion image
notion image

Where are We in CS61A?

notion image
notion image
notion image

What are Continers Good For?

  1. Allow us to store related values together
    1. Can process the values one-by-one or inaggregate
    2. Allows us to from compound values through data abstraction
  1. Give rise to a number of ways of storing values
    1. Lists store values in order,associated with an index
    2. Dictionaries have no order but associated values with any sort of key
    3. Trees allow for a hierarchical representation od data

The Many Use of Trees

Trees show up in:
  • Efficiently searching data (e.g. Autocomplete)
  • Artifficial Intelligence (Game Trees/the minimax algorithm)
  • Machine Learning (Decision Trees)
  • Computational Biology (Suffix Trees, Phylogenetic Trees)
  • Programming Languages (Syntax and Expression Trees)
  • Operating Systems (File Structure)
notion image

Mutability

  • Data abstraction allows us to think about compound values as units, or objects
  • But compound values have state that change over time; they are mutable
  • So far, we treated all our values as immutable; we only created new objects, never changing them
notion image
notion image
记住:赋值的行为
notion image

Mutation Operations

Add Element

appendinsert 都是针对的单个元素需要放的内容
extend 针对的是铺平多个元素

Remove Element

pop 默认删除最后一个元素,也可以指定索引删除,返回删除的元素
remove() 函数用于移除列表中某个值的第一个匹配项,没有返回值
notion image
notion image
 
C#知识学习—15 委托详解C#知识学习—13 字段,属性,索引器,常量
  • Waline
Kitety
Kitety
独特为佳
公告
我曾经七次鄙视自己的灵魂
--卡里·纪伯伦
第一次,当它本可进取时,却故作谦卑;
第二次,当它在空虚时,用爱欲来填充;
第三次,在困难和容易之间,它选择了容易;
第四次,它犯了错,却借由别人也会犯错来宽慰自己;
第五次,它自由软弱,却把它认为是生命的坚韧;
第六次,当它鄙夷一张丑恶的嘴脸时,却不知那正是自己面具中的一副;
第七次,它侧身于生活的污泥中,虽不甘心,却又畏首畏尾。
 
最新评论
Loading...