网站首页 站内搜索

搜索结果

查询Tags标签: queue,共有 628条记录
  • Heap堆的基本功能数组实现

    众所周知,堆是一种很好用的数据结构,是基于完全二叉树的。1 //堆的数组实现2 const int Maxsize = 10000;3 int len = 0; //记录当前size4 int heap[Maxsize+1];5 6 //当然也可以用vector实现7 vector <int> Heap;8 9 //每一次插入新的数据,都要和它的父节点比…

    2022/4/14 6:19:44 人评论 次浏览
  • tp5.1 + think-queue + supervisor

    项目用的是 TP5.1 框架,消息队列用的think-queue消息队列,结合 supervisor 进程管理使队列进程常驻。在这里记录一下顺便分享给大家,下面逻辑是加入队列、消费队列和写入数据库。 一、tp5.1的安装方法  用 composer 安装最新稳定版本composer create-project topthin…

    2022/4/14 6:19:17 人评论 次浏览
  • 515. Find Largest Value in Each Tree Row

    My BFS solution:/*** Definition for a binary tree node.* public class TreeNode {* int val;* TreeNode left;* TreeNode right;* TreeNode() {}* TreeNode(int val) { this.val = val; }* TreeNode(int val, TreeNode left, TreeNode right)…

    2022/4/12 6:14:49 人评论 次浏览
  • 346. Moving Average from Data Stream

    class MovingAverage {Queue<Integer> queue = new LinkedList<>();int size = 0;double sum=0;public MovingAverage(int size) {this.size = size;}public double next(int val) {if(queue.size()==size){sum-=queue.poll();}queue.offer(val);sum+=val;ret…

    2022/4/9 6:19:20 人评论 次浏览
  • Python:【列表】基本用法

    一、列表 列表(list)中的数据项不需要具有相同的类型,索引从0开始,元素方括号[]中,每个元素用逗号","隔开。 1.初始化 ① 空列表 可使用直接初始化空列表[],也可用list()方法。 list()方法语法: list(seq) seq:要转换为列表的元组或字符串。 返回值:列表。…

    2022/4/8 14:19:18 人评论 次浏览
  • 301. Remove Invalid Parentheses

    Just use BFS to solve this problem: 1. put the s to queue 2. if s is not a valid string, then remove a ( or ), and then put to the queue. 3. once find valid strings, return.class Solution {public List<String> removeInvalidParentheses(String s) {…

    2022/4/7 6:20:47 人评论 次浏览
  • locust 使用队列进行参数化操作

    Queue是python标准库中的线程安全的队列(FIFO)实现,提供了一个适用于多线程编程的先进先出的数据结构,即队列,用来在生产者和消费者线程之间的信息传递 基本方法: Queue.Queue(maxsize=0) FIFO,如果maxsize小于1就表示队列长度无限Queue.LifoQueue(maxsize=0) LIFO,…

    2022/4/5 23:49:06 人评论 次浏览
  • [简单] 622. 设计循环队列

    https://leetcode-cn.com/problems/design-circular-queue/ 请原谅我直接,这一题。。。我这么傻心里都嘀咕,怎么出得那么傻~没有灵魂得题目。class MyCircularQueue {List<Integer> queue = new ArrayList<>();Integer capacity = 100000;public MyCircula…

    2022/4/4 6:19:05 人评论 次浏览
  • python 进程间利用queue 传递参数

    from multiprocessing import Processdef chulibkk(bka,q):global connect,confor acc in acca:result=[]aty=str(acc["rootId"])userid=str(acc[userId])q.put(userid)def wm0323(q):global con,connectwhile 1:sql2="select bk from bkdxy where zg<&…

    2022/4/1 7:21:24 人评论 次浏览
  • Cloud Design Patterns & Architecture Styles

    Cloud Design Patterns CategoriesData Management Design and Implementation Messaging Patterns Ambassador Anti-Corruption Layer Asynchronous Request-Reply Backends for Frontends Bulkhead Cache-Aside Choreography Circuit Breaker Claim Check Compensating …

    2022/3/30 23:21:17 人评论 次浏览
  • 做题常用容器及方法

    queue,stack,priority_queue,没有clear函数,如果要清除 q=queue(); 创建一个新的

    2022/3/28 6:24:09 人评论 次浏览
  • Java的引用类型

    引用类型 强引用 强引用是常见的引用类型,通常通过new形式创建的对象都是强引用对象 Object o=new Object(); 强引用作用的对象无论何时都不会被清理掉 只要强引用存在,GC永不回收掉被引用的对象,通过关键字new创建的对象所关联的引用就是强引用,只要这个强引用还指向…

    2022/3/21 11:27:43 人评论 次浏览
  • python基本操作

    help: 查看函数或者对象的帮助文档 type: 查看对象的类型 dir: 查看包下有哪些函数和类字符串处理相关 字符串处理是写程序遇到的最多的一个场景,如果是以前,我可能会这样写:>>> name = john >>> age = 27 >>> content = Hello, my name is …

    2022/3/20 14:28:38 人评论 次浏览
  • 二叉树的四种遍历

    文章目录 先序、中序、后序遍历(递归)层序遍历先序、后序、中序遍历(非递归)输入样例: 124005003600700 0先序、中序、后序遍历(递归) #include <stdio.h> #include <stdlib.h>#define MaxSize 100typedef struct BiTNode {char data;struct BiTNode *…

    2022/3/19 23:58:36 人评论 次浏览
  • C++ 11 利用std::queue创建安全队列 等待队列

    头文件:#include <mutex> #include <queue> #include <functional> #include <future> #include <thread> #include <utility> #include <vector>#include <condition_variable>class SafeQueue { private:std::queue&l…

    2022/3/19 17:27:52 人评论 次浏览
扫一扫关注最新编程教程