• Queue(队列)


      队列是一种后进后出的数据结构,下面介绍一下队列中常见的函数;

    一、queue 中的 empty 函数

      queue<int> q ;

      q.empty() ;     // 若队列中无元素,返回true ,否则返回false ;

    二、queue 中的 size 函数

      queue<int> q ;

      q.size() ;       // 返回队列中元素的个数

    三、queue 中的 front 函数 

      queue<int> q ;

      q.front() ;    // 返回队列中的第一个元素 

    四、queue 中的 back 函数

      queue<int> q ;

      q.back() ;    // 返回队列中最后一个元素

    五、queue 中的 push 函数

      queue<int> q ;

      q.push(5) ;     // 在队列最后插入一个元素 5 ;

    六、queue 中的 pop 函数 

      queue<int> q ;

      q.pop() ;     // 删除队列的第一个元素

  • 相关阅读:
    Django学习2
    Django学习1
    python 基于tcp协议的文件传输3_解决粘包问题
    python socketserver
    python hashlib
    python struct模块
    python json 模块
    python socket模块
    13暑假集训#10 总结
    hdu 4493 卡输入输出
  • 原文地址:https://www.cnblogs.com/scottding/p/3664980.html
Copyright © 2020-2023  润新知