第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
  • 數(shù)據(jù)結(jié)構(gòu)是指
    查看全部
    1 采集 收起 來源:課程簡介

    2018-11-23

  • FIFO先進(jìn)先出
    查看全部
    0 采集 收起 來源:隊列

    2018-11-02

  • 普通隊列費時間費空間

    環(huán)形隊列優(yōu)先級比普通隊列高,可以充分利用空間

    查看全部
    0 采集 收起 來源:隊列

    2018-09-02

  • 兩種隊列處理方式,各有優(yōu)劣,更具具體的情況處理

    內(nèi)存占用少,但是效率低下
    內(nèi)存占用多,效率較高。

    使用環(huán)形隊列處理,head/tail;采用順時針或逆時針皆可,當(dāng)隊頭隊尾在使用是具有高效低內(nèi)存的優(yōu)點,不適用順序隊列。使用環(huán)形隊列作為編碼典范。(應(yīng)用:自動排號機)

    查看全部
    1 采集 收起 來源:隊列

    2018-08-29

  • 隊列的用途

    查看全部
    0 采集 收起 來源:隊列

    2018-08-07

  • 查看全部
  • /********************************

    ********? ? ?環(huán)形隊列? ? ?*******

    *********************************/

    #ifndef MYQUEUE_H_

    #define MYQUEUE_H_


    #include <iostream>

    using namespace std;


    const int DefaultCapacitySize = 20;


    template <typename T>

    class MyQueue

    {

    public:

    MyQueue();

    ~MyQueue();

    bool ClearQueue() ; // 清空隊列

    bool IsEmpty() ;? // 判斷隊列是否為空

    bool IsFull(); // 判斷隊列是否為滿

    int QueueLen(); // 返回隊列長度


    bool InsertQueue(const T elem); // 插入元素

    bool DeleteQueue(T & elem); // 刪除元素


    bool TraverseQueue() ;? // 遍歷隊列


    private:

    T * m_data;? // 存放數(shù)據(jù)

    int iHead;? ?// 指向隊列頭部

    int iTail;? ?// 指向隊列尾部

    int m_capacity; // 隊列容量

    int m_length;? ?// 隊列長度

    };


    // 構(gòu)造函數(shù)

    template <typename T>

    MyQueue<T>::MyQueue()

    {

    m_data = new T [DefaultCapacitySize];

    iHead = 0;

    iTail = 0;

    m_capacity = DefaultCapacitySize;

    m_length = 0;

    }


    // 析構(gòu)函數(shù)

    template <typename T>

    MyQueue<T>::~MyQueue()

    {

    delete [] m_data;

    m_data = NULL;

    }


    // 清空隊列

    template <typename T>

    bool MyQueue<T>::ClearQueue()?

    {

    m_length = 0;

    iHead = 0;

    iTail = 0;

    return true;

    }


    // 判斷隊列是否為空

    template <typename T>

    bool MyQueue<T>::IsEmpty()?

    {

    return (m_length == 0) ? true : false;

    }


    // 判斷隊列是否為滿

    template <typename T>

    bool MyQueue<T>::IsFull()?

    {

    return (m_length == m_capacity) ? true : false;

    }


    // 返回隊列長度

    template <typename T>

    int MyQueue<T>::QueueLen()?

    {

    return m_length;

    }


    // 插入元素

    template <typename T>

    bool MyQueue<T>::InsertQueue(const T elem)?

    {

    if (IsFull())

    return false;

    m_data[iTail] = elem;

    iTail++;

    iTail %= m_capacity;

    m_length++;

    return true;


    }


    // 刪除元素

    template <typename T>

    bool MyQueue<T>::DeleteQueue(T & elem)?

    {

    if (IsEmpty())

    return false;

    elem = m_data[iHead];

    iHead++;

    iHead %= m_capacity;

    m_length--;

    return true;

    }


    // 遍歷隊列

    template <typename T>

    bool MyQueue<T>::TraverseQueue()?

    {

    if (IsEmpty())

    return false;

    for (int i = iHead; i < m_length + iHead; i++)

    {

    cout << m_data[i % m_capacity] << "? ?";

    }

    cout << endl;

    return true;

    }


    #endif


    查看全部
  • 1.環(huán)形隊列入隊 head++; head = head % capacity; 2.環(huán)形隊列出隊 tail++; tail = tail % capacity; 3.遍歷環(huán)形隊列時要注意循環(huán)變量應(yīng)初始化為隊首指針?biāo)赶虻臄?shù)組下標(biāo),輸出時要對循環(huán)變量進(jìn)行求余操作(i % capacity)以防數(shù)組下標(biāo)越界問題的發(fā)生 for(int i = head; i < length + head; i++) ?cout<<QueueData[i % capacity]<<" ?";

    查看全部
  • class MyQueue { // 注釋:講解一些 C 語言用法 public: MyQueue(int queueCapacity); // InitQueue(&Q) 創(chuàng)建隊列 virtual ~MyQueue(); // DestoryQueue(&Q) 銷毀隊列 void ClearQueue(); // ClearQueue(&Q) 清空隊列 bool QueueEmpty() const; // QueueEmpty(Q)判空隊列 int QueueLength() const; // QueueLength(Q) 隊列長度 bool EnQueue(int element); // EnQueue(&Q, element) 新元素入隊 bool DeQueue(int &element); // DeQueue(&Q, &element)首元素出隊 void QueueTraverse(); // QueueTraverse(Q,visit()) 遍歷隊列,visit()函數(shù):訪問的方法 private: int *m_pQueue; // 隊列數(shù)組指針 int m_iQueuelen; // 隊列元素個數(shù) int m_iQueueCapacity; // 隊列數(shù)組容量 };

    查看全部
  • 普通隊列存在的缺點: 1、若是一個元素出隊列后,其他元素統(tǒng)一前移,補充空位,則時間效率降低。 2、若是一個元素出隊列后,其他元素位置保持不變,空位保留,則空間利用率低。


    查看全部
    2 采集 收起 來源:隊列

    2018-06-30

  • 隊列:先入先出。

    查看全部
    1 采集 收起 來源:隊列

    2018-04-15

  • #include?<iostream>
    #include?<string>
    
    using?namespace?std;
    
    
    class?Customer{
    public:
    	Customer(){
    		//需要默認(rèn)構(gòu)造函數(shù)
    	}
    	
    	Customer(string?name,?int?age){
    		m_strName?=?name;
    		m_iAge?=?age;
    	}
    
    	void?printInfo()?const{
    		cout?<<?"姓名:?"?<<?m_strName?<<?endl;
    		cout?<<?"年齡:?"?<<?m_iAge?<<?endl;
    		cout?<<?endl;
    	}
    	
    private:
    	string?m_strName;
    	int?m_iAge;
    };
    
    
    
    
    template?<class?T>
    class?MyQueue{
    public:
    	MyQueue(int?queueCapacity){
    		m_iQueueCapacity?=?queueCapacity;
    		m_iQueueLen?=?0;
    		m_iHead?=?0;
    		m_iTail?=?0;
    		m_pQueue?=?new?T[queueCapacity];
    	}
    	
    	~MyQueue(){
    		delete[]?m_pQueue;
    	}
    	
    	void?QueueClear(){
    		m_iQueueLen?=?0;
    		m_iHead?=?0;
    		m_iTail?=?0;
    	}
    	
    	bool?QueueEmpty()?const{
    		if(m_iQueueLen==0){
    			return?true;
    		}
    		else{
    			return?false;
    		}
    	}
    	
    	bool?QueueFull()?const{
    		if(m_iQueueLen==m_iQueueCapacity){
    			return?true;
    		}
    		else{
    			return?false;
    		}
    	}
    	
    	bool?EnQueue(T?element){
    		if(QueueFull()){
    			return?false;
    		}
    		else{
    			m_pQueue[m_iTail]?=?element;
    			m_iTail?++;
    			m_iTail?=?m_iTail?%?m_iQueueCapacity;
    			m_iQueueLen?++;
    			return?true;
    		}
    	}
    	
    	bool?DeQueue(T?&element){
    		if(QueueEmpty()){
    			return?false;
    		}
    		else{
    			element?=?m_pQueue[m_iHead];
    			m_iHead?++;
    			m_iHead?=?m_iHead?%?m_iQueueCapacity;
    			m_iQueueLen?--;
    			return?true;
    		}
    	}
    	
    	void?QueueTraverse(){
    		for(int?i?=?m_iHead;?i?<?m_iHead?+?m_iQueueLen;?i++){
    			m_pQueue[i%m_iQueueCapacity].printInfo();
    		}
    	}
    	
    private:
    	T*?m_pQueue;
    	int?m_iHead;
    	int?m_iTail;
    	int?m_iQueueLen;
    	int?m_iQueueCapacity;
    };
    
    
    
    
    
    int?main(int?argc,?char?*argv[])?{
    	MyQueue<Customer>*?p?=?new?MyQueue<Customer>(4);
    	p->EnQueue(Customer("imooc",?20));
    	p->QueueTraverse();
    }


    查看全部
  • 1

    查看全部
  • 請輸入筆記內(nèi)容...

    查看全部

舉報

0/150
提交
取消
課程須知
本課程是程序世界中的核心課程 由于本門課程是以C++為編碼實現(xiàn)的,所以需要大家熟練掌握C++語言基礎(chǔ)語法。
老師告訴你能學(xué)到什么?
1、什么是數(shù)據(jù)結(jié)構(gòu)、什么是隊列以及隊列的實現(xiàn)原理 2、如何設(shè)計隊列的類,如何完善類的設(shè)計 3、如何實現(xiàn)隊列的相關(guān)函數(shù) 4、如何檢驗代碼的正確性,如何完善代碼 5、如何與實際相結(jié)合,利用數(shù)據(jù)結(jié)構(gòu)解決實際問題

微信掃碼,參與3人拼團

微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

友情提示:

您好,此課程屬于遷移課程,您已購買該課程,無需重復(fù)購買,感謝您對慕課網(wǎng)的支持!