ICode9

精准搜索请尝试: 精确搜索
  • python链接2022-08-18 22:04:41

    import redis# 链接redis host,port,db# 建立链接con = redis.StrictRedis( host='127.0.0.1', port=6379, db=4, # 默认使用的是0号 decode_responses=True)# string类型# con.set('name','chuan')# name = con.get('name')# print(nam

  • 二、Redis五大数据类型2022-06-19 16:33:49

    一. String 1. append key1 “hello” 往key1为键的值后面追加“hello”,如果key1不存在,则创建key1为hello 2. strlen key1 查看key1值的长度 3. incr view 加一 4. decr view 减一 5. increby 10 加十 6. decreby 10 减十 7. getrange key1 0 3 截取字符串下表0-3的子字符串 8. se

  • 10.Redis高级使用以及和python互动2022-04-16 19:00:06

    和python进行互动 安装redis库 pip3 install redis 连接数据库 import redis # StrictRedis和Redis效果一样,后者是前者的子集 r = redis.StrictRedis(host='localhost',port=6379,db=0) r.set("key1","value111") print(r.get("key1").decode("utf-8&qu

  • Redis五大数据类型之set+hash+zset2022-04-16 07:00:05

    set 集合 set是无序不重复的集合 无序就无法通过下标或者序列号查询 不重复 天然有去重的效果 集合的命令都是以S开头的 添加元素 ,查询元素 127.0.0.1:6379> sadd myset "key" #set集合添加一个元素 (integer) 1 127.0.0.1:6379> sadd myset "key1" (integer) 1 127.0.0.1:6379

  • leetcode2133.检查是否每一行每一列都包含全部整数(简单,周赛)2022-01-11 10:59:58

    在自己的代码上做优化: 1.用一个双循环实现行和列的同时访问: for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { //matrix[i][j] //matrix[j][i] } } 2.看一下matrix[i][j]取值范围:放入hash后直接判断size()是否等于n就好了,不用跟存1-n的hash来比较。

  • Redis小册子2021-09-09 11:01:19

    【String基础语法】 set #设置值 set animal "dog" get #获取值 get animal mset #设置多个值 mset animal1 "dog" animal2 "cat" mget #获取多个值 mget animal1 animal2 append #追加字符串到已有字符串变量 append animal "cat" #animal是“dogcat” del

  • redis022021-06-27 21:34:51

    14. incrby 同 incr 类似,加指定值 ,key 不存在时候会设置 key,并认为原来的 value 是 0 127.0.0.1:6379> incrby ageA 10 12 127.0.0.1:6379> incrby ageAB 10 10 15. decr 对 key 的值做的是减减操作,decr 一个不存在 key,则设置 key 为-1 1

  • unorder_map + pair2021-05-12 17:30:17

    传入 pair 的哈希函数 struct hash_pair { template <class T1, class T2> size_t operator()(const pair<T1, T2>& p) const { auto hash1 = hash<T1>{}(p.first); auto hash2 = hash<T2>{}(p.second); retur

  • hash2021-04-26 21:02:55

    #include <bits/stdc++.h> typedef unsigned long long ll; const ll P=1331; using namespace std; ll hash1[1000000],u[1000000]; ll get(int l,int r){ return hash1[r]-hash1[l-1]*u[r-l+1]; } int main() { ios::sync_with_stdio(false); int n,m;

  • Redis 前记2021-04-14 12:05:20

    Redis 操作都是很快的 属于微妙级操作 1.Redis为什么这么快   存储结构?     Redis使用了一个哈希表来存储key - val     一个哈希表就是一个数组,每个数组元素称为哈系桶,所以一个哈希表是多个哈系桶组成的,每个哈系桶保存了键值数据.     那么哈希桶的值是集合类

  • 二维哈希2021-03-24 20:06:11

    参考:http://www.bubuko.com/infodetail-3544495.html ac代码+解析: #include <bits/stdc++.h> #define INF 0x3f3f3f3f using namespace std; typedef unsigned long long ull; #define base1 3 #define base2 5//这两个数尽量为奇数 int n,m,p,q; ull hash_code1;//小矩阵

  • 排列组合(选数,填坑问题)2021-01-27 17:03:59

    排列组合(选数,填坑问题) 1. 排列: (1)哈希判重递归 说明: #适合每个元素互不相同的数列(有相同的会出错) #每种排列互不相同 #不适合利用全排列枚举求和问题(会有重复) #include <bits/stdc++.h> using namespace std; int x[5]={0,1,2,3,4},f[5]; bool hash1[5]; void tiankeng(int po

  • 1657. Determine if Two Strings Are Close (M)2021-01-23 11:04:14

    Determine if Two Strings Are Close (M) 题目 Two strings are considered close if you can attain one from the other using the following operations: Operation 1: Swap any two existing characters. For example, abcde -> aecdb Operation 2: Transform ever

  • 牛客挑战赛46 D2020-12-14 21:02:25

    include include include include include include include include include include include include //#include include include include<unordered_map> pragma GCC diagnostic error "-std=c++11" pragma GCC optimize("-fdelete-null-pointer-che

  • 299.猜数字游戏2020-06-19 09:53:54

    2020-06-19 猜数字游戏 你在和朋友一起玩 猜数字(Bulls and Cows)游戏,该游戏规则如下: 题解: 思路1:哈希表 var getHint = function (secret, guess) { let hash1 = new Map(), hash2 = new Map(), bull = 0, cows = 0; for (let i = 0; i < secret.length; i++) { if (h

  • 布隆过滤器理解2019-10-04 22:56:20

    https://learnblockchain.cn/2019/04/30/bloom_filter/ 可以理解为 对内容做多次摘要,把内容换成更小体积的标识位来存放。 要判断一个元素是不是在一个集合里,比较容易想到的方法是用数组,链表这样的数据结构把元素保存起来,然后依次比较来确定。 但是随着集合的变大,上面的这种方法就

  • 13、Python3 Redis Hash2019-08-30 20:01:15

    Redis hash 是一个键值(key=>value)对集合。 Redis hash 是一个 string 类型的 field 和 value 的映射表,hash 特别适合用于存储对象。Redis 中每个 hash 可以存储 2^32 - 1 键值对(40多亿)。 Hash基本命令: 1、单个增加/取出 (1)单个增加 hset(key, field, value) 返回值 如果

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有