cc.日常

本文深入探讨了Python编程中的集合操作,包括创建、遍历、元素增删等,并展示了如何使用`qsort`函数进行排序。同时,文章涵盖了词汇表,涉及编程术语与一般概念,如`dubious`、`rhetoric`和`ministry`,并提及了算法和数据结构的重要性。
摘要由CSDN通过智能技术生成

2/6

parameter 参数

dubious 有问题的

torrent 激流

satire 讽刺

slum 贫民窟

skeleton 骨架

lord 上帝

antenna 触角

racial 种族的

rhetoric 修辞的

indicative 表示的

maneuver 演习

terminate 结束

dominate 支配

magnify 夸大

rigid 严格的

junction 连接处

campaign 战役

grieve 悲伤

invade 侵入

amend 修正

corrode 侵蚀

courtesy 礼貌

property 资产

temper 脾气

urgent 紧迫的

dividend 回报

consecutive 连续不断的

obsession 着迷

zigzag 之字形

obscure 难懂的,模糊的,不重要的,难理解的

conviction 判罪

eligible 有资格的

hollow 空的

molecule 分子的

budget 预算

ministry 部门

overhaul 赶上

squeeze 紧握

conservative 保守的

register 登记

obedience 顺从

persecute 迫害

spine 脊骨


python

#集合遍历
t=('python','world',98)
print (t[0])
print (t[1])
print (t[2])
for item in t:
    print(item)

#集合的创建
#第一种创建方式{}
s={1,1,2,3,4,5,5}
print(s)  #{1, 2, 3, 4, 5} 不允许重复

#第二种创建方式使用set()
s1=set(range(6))
print(s1,type(s1))   #{0, 1, 2, 3, 4, 5} <class 'set'>

s2=set([1,2,3,4,5,6])
print(s2,type(s2))   #{1, 2, 3, 4, 5, 6} <class 'set'>

s3=set((1,2,3,4,5,6))  #集合中的元素是元序的
print(s3,type(s3))   #{1, 2, 3, 4, 5, 6} <class 'set'>

s4=set('python')
print(s4,type(s4))   #{'n', 't', 'p', 'o', 'h', 'y'} <class 'set'>

s5=set({1,1,222,3,5,5,4,33})
print(s5,type(s5))   #{1, 33, 3, 4, 5, 222} <class 'set'>

#定义一个空集合
s6={}
print(type(s6))

#集合的相关操作
#in  和 not in
#元素的新增
s.add(80)
s.update({100,20,3})
s.update((3,4,5,6))
#元素的删除操作
s.remove(1)
s.discard(1)
s.pop(1)
s.clear()  #清空集合

2/7

peculiar 独特的

odds 机会

dubious 有问题的

expertise 专长

rally 群众大会 集结

obsession 着迷

navigation 航海

adjacent 邻近的

rigid 严厉的

novelty 新奇的事物

stride 大步走

prosper 蓬勃发展

agenda 潜在意图

faithful 忠实的

trifle 琐事

transistor 晶体管

satire 讽刺

lofty 巍峨的

ministry 部门

rhetoric 修辞

renaissance 文艺复兴

contingent 偶然的

vanity 虚荣心

consecutive 连续不断的

beam 光纤 光束 笑容满面

dental 牙齿的

molecule 分子

dial 刻度盘

indispensable 不可或缺的

feminine 女性的

aggregate 合计

the country has performed a miracle by lifting most of its people out of poverty.

degenerate 退化

surveillance 监视


 

/**
 * Note: The returned array must be malloced, assume caller calls free().
 */
 int cmp(const void* _a,const void* _b){
     int a=*(int*)_a,b=*(int*)_b;
     return a-b;
 }
int* sortedSquares(int* nums, int numsSize, int* returnSize){
    int*a=malloc(sizeof(int)*numsSize);
    (*returnSize)=numsSize;
    for(int i=0;i<numsSize;i++){
        a[i]=nums[i]*nums[i];  
    }
    qsort(a,numsSize,sizeof(int),cmp);
    return a;
    }

qsort (快排函数)函数声明

void qsort(void *base, size_t nitems, size_t size, int (*compar)(const void *, const void*))

参数

  • base -- 指向要排序的数组的第一个元素的指针。
  • nitems -- 由 base 指向的数组中元素的个数。
  • size -- 数组中每个元素的大小,以字节为单位。
  • compar -- 用来比较两个元素的函数。

题中:

int cmp(const void* _a,const void* _b){
     int a=*(int*)_a,b=*(int*)_b;
     return a-b;
 }

leetcode算法入门

zqa老师yyds!


 Midea测评

冬奥会1000m速滑决赛

明天去医院

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值