亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? heap.h

?? 游戲開(kāi)發(fā)數(shù)據(jù)結(jié)構(gòu)-Data.Structures.for.Game.Programmers
?? H
字號(hào):
// ============================================================================
// Data Structures For Game Programmers
// Ron Penton
// Heap.h
// This is the heap class
// ============================================================================

#ifndef HEAP_H
#define HEAP_H

#include "Array.h"


// ----------------------------------------------------------------
//  Name:           Heap
//  Description:    This is the heap class, an efficient priority
//                  queue.
// ----------------------------------------------------------------
template <class DataType>
class Heap : public Array<DataType>
{
public:


// ----------------------------------------------------------------
//  Name:           Heap
//  Description:    constructor; creates a heap with a size
//                  and a comparison function
//  Arguments:      p_size: the size of the heap.
//                  p_compare: a comparison function pointer.
//  Return Value:   None.
// ----------------------------------------------------------------
    Heap( int p_size, int (*p_compare)(DataType, DataType) )
    : Array<DataType>( p_size + 1 )
    {
        m_count = 0;
        m_compare = p_compare;
    }


// ----------------------------------------------------------------
//  Name:           Enqueue
//  Description:    Adds new data to the queue.
//  Arguments:      p_data: the data to add
//  Return Value:   None.
// ----------------------------------------------------------------
    void Enqueue( DataType p_data )
    {
        m_count++;

        // if we ran out of room, double the size of the heap.
        if( m_count >= m_size )
            Resize( m_size * 2 );

        // insert the data at the bottom of the heap
        m_array[m_count] = p_data;

        // walk it up to its correct position.
        WalkUp( m_count );
    }


// ----------------------------------------------------------------
//  Name:           Dequeue
//  Description:    removes the top of the heap
//  Arguments:      None
//  Return Value:   None.
// ----------------------------------------------------------------
    void Dequeue()
    {
        // if the count is more than or equal to one, then we can remove
        // the item, else, there is nothing to remove.
        if( m_count >= 1 )
        {
            m_array[1] = m_array[m_count];
            WalkDown( 1 );
            m_count--;
        }
    }


// ----------------------------------------------------------------
//  Name:           Item
//  Description:    gets the top of the heap
//  Arguments:      None
//  Return Value:   a reference to the top of the heap.
// ----------------------------------------------------------------
    DataType& Item()
    {
        return m_array[1];
    }



// ============================
//        HEAP HELPERS
// ============================


// ----------------------------------------------------------------
//  Name:           WalkUp
//  Description:    Walks an item up the heap into the right
//                  position.
//  Arguments:      p_index: the index of the place to start
//  Return Value:   None.
// ----------------------------------------------------------------
    void WalkUp( int p_index )
    {
        // set up the parent and child indexes
        int parent = p_index / 2;
        int child = p_index;

        // store the item to walk up in a temporary buffer.
        DataType temp = m_array[child];

        while( parent > 0 )
        {   // if the node to walk up is more than the parent,
            // then swap nodes.
            if( m_compare( temp, m_array[parent] ) > 0 )
            {
                // swap the parent and child, and go up a level.
                m_array[child] = m_array[parent];
                child = parent;
                parent /= 2;
            }
            else
                break;
        }

        // put the temp variable (the one that was walked up)
        // into the child index.
        m_array[child] = temp;
    }


// ----------------------------------------------------------------
//  Name:           WalkDown
//  Description:    Walks an item down the heap into the right
//                  place.
//  Arguments:      p_index: index of the item to start at.
//  Return Value:   None.
// ----------------------------------------------------------------
    void WalkDown( int p_index )
    {
        // calculate the parent and child indexes.
        int parent = p_index;
        int child = p_index * 2;

        // store the data to walk down in a temporary buffer.
        DataType temp = m_array[parent];

        // loop through, walking node down heap until both children are
        // smaller than node.
        while( child < m_count )
        {
            // if left child is not the last node in the tree, then
            // find out which of the current node's children is largest.
            if( child < m_count - 1)
            {
                if( m_compare( m_array[child], m_array[child + 1] ) < 0 )
                {   // change the pointer to the right child, since it is larger.
                    child++;
                }
            }
            // if the node to walk down is lower than the highest value child,
            // move the child up one level.
            if( m_compare( temp, m_array[child] ) < 0 )
            {
                m_array[parent] = m_array[child];
                parent = child;
                child *= 2;
            }
            else
                break;
        }
        m_array[parent] = temp;
    }


// ----------------------------------------------------------------
//  Name:           m_count
//  Description:    The number of items in the heap.
// ----------------------------------------------------------------
    int m_count;

// ----------------------------------------------------------------
//  Name:           m_compare
//  Description:    The comparison function.
// ----------------------------------------------------------------
    int (*m_compare)(DataType, DataType);
};



#endif

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日精品一区二区三区| 国产人成一区二区三区影院| 韩国av一区二区| 国产精品私房写真福利视频| 欧美日韩在线播放三区四区| 国产一区二区成人久久免费影院| 一区二区在线观看视频| 亚洲精品在线观看网站| 欧美巨大另类极品videosbest| 粉嫩久久99精品久久久久久夜| 日韩精品视频网站| 亚洲精品老司机| 国产精品三级电影| 精品不卡在线视频| 678五月天丁香亚洲综合网| 色综合久久天天| eeuss鲁片一区二区三区 | 日韩电影在线一区二区三区| 亚洲国产精华液网站w| 日韩久久久精品| 欧美狂野另类xxxxoooo| 欧美这里有精品| 99国产精品国产精品毛片| 国产精品自拍三区| 黄色精品一二区| 蜜臀国产一区二区三区在线播放| 激情久久五月天| 久久综合九色综合97婷婷女人| 欧美视频一区二| av电影天堂一区二区在线观看| 国产精品一区专区| 久久黄色级2电影| 日韩av中文字幕一区二区三区 | 国产欧美日产一区| 欧美精品一区二区在线播放| 日韩欧美国产综合| 正在播放亚洲一区| 欧美军同video69gay| 欧美精品一二三| 欧美精品高清视频| 777xxx欧美| 日韩三级精品电影久久久| 91精品欧美综合在线观看最新| 欧美久久久久久蜜桃| 欧美三区在线视频| 制服视频三区第一页精品| 日韩欧美精品在线| 久久亚洲综合色一区二区三区 | 国产精品人妖ts系列视频| 国产人成一区二区三区影院| 国产精品国产a| 国产精品国产三级国产aⅴ入口 | 欧美videossexotv100| 欧美一区二区三区白人| 欧美v国产在线一区二区三区| 日韩美女一区二区三区| 久久久久久久久久美女| 国产亚洲精品福利| 中文字幕一区免费在线观看| 伊人色综合久久天天| 三级成人在线视频| 国内精品免费**视频| 国产成人免费视频网站| 欧美优质美女网站| 日本精品裸体写真集在线观看| 在线观看亚洲a| 欧美tickling挠脚心丨vk| 国产亚洲欧美一区在线观看| 最新欧美精品一区二区三区| 亚洲成人资源网| 九九**精品视频免费播放| 成人h动漫精品一区二| 91成人国产精品| 欧美一区二区黄色| 国产精品美女久久久久久| 一区二区三区日韩精品| 日本不卡一区二区三区| 国产成人h网站| 欧美色图片你懂的| 精品久久久久香蕉网| 中文字幕一区二区三区在线播放| 亚洲柠檬福利资源导航| 青青草97国产精品免费观看| 成人性生交大片免费| 欧美高清激情brazzers| 精品入口麻豆88视频| 中文字幕第一区第二区| 亚洲一区二区美女| 精品一区二区国语对白| 色婷婷综合久色| 欧美精品一区二区三区一线天视频| 亚洲精品少妇30p| 久久不见久久见中文字幕免费| 99久久久国产精品免费蜜臀| 日韩精品在线一区二区| 亚洲综合色网站| 国产一区二区免费视频| 欧美欧美欧美欧美| 欧美国产日韩一二三区| 日本一不卡视频| 一本色道久久加勒比精品| 久久精品亚洲乱码伦伦中文 | 亚洲同性同志一二三专区| 日韩高清在线一区| 色狠狠综合天天综合综合| 2023国产精品视频| 婷婷丁香久久五月婷婷| 91网页版在线| 久久精品日韩一区二区三区| 无码av免费一区二区三区试看 | 一区二区在线观看视频| 日本不卡的三区四区五区| 91在线云播放| 国产午夜亚洲精品理论片色戒| 日韩不卡在线观看日韩不卡视频| 99国内精品久久| 国产亚洲污的网站| 九一久久久久久| 4438成人网| 日韩精品欧美成人高清一区二区| 欧美日韩在线三区| 亚洲免费观看在线观看| 成人国产精品视频| 久久久电影一区二区三区| 久久国产麻豆精品| 日韩午夜精品电影| 亚洲成av人综合在线观看| 色婷婷综合久久久中文字幕| 日韩伦理电影网| 色综合咪咪久久| 亚洲精品成人在线| 色欲综合视频天天天| 亚洲丝袜制服诱惑| jvid福利写真一区二区三区| 欧美韩日一区二区三区| 大胆亚洲人体视频| 日本一二三四高清不卡| 成人91在线观看| 欧美国产97人人爽人人喊| eeuss鲁一区二区三区| 国产午夜精品久久久久久免费视| 成人aa视频在线观看| 国产无人区一区二区三区| 国产精品自在在线| 国产视频在线观看一区二区三区| 国产成人av网站| 国产精品久久毛片| 色狠狠一区二区三区香蕉| 一区二区理论电影在线观看| 欧美日韩在线播放一区| 日本一区中文字幕| 久久久久久久精| 不卡一区二区在线| 一区二区日韩av| 777xxx欧美| 国产成人啪免费观看软件| 国产精品成人一区二区三区夜夜夜| 91一区二区在线| 亚洲国产精品一区二区尤物区| 日韩欧美亚洲国产精品字幕久久久| 国产乱码精品一区二区三区忘忧草| 国产女同互慰高潮91漫画| 色综合天天综合网天天看片| 午夜久久久久久久久久一区二区| 日韩免费一区二区| 高清国产一区二区三区| 一区二区三区在线免费视频| 日韩一区二区免费高清| 国产99精品视频| 亚洲一二三四在线观看| 日韩精品中文字幕在线不卡尤物 | 国产精品天天看| 在线视频综合导航| 日韩电影在线免费观看| 久久久国际精品| 欧美午夜精品一区二区蜜桃| 麻豆成人在线观看| 中文字幕在线一区免费| 91麻豆精品国产91| 成人免费毛片a| 五月天一区二区| 国产精品伦一区二区三级视频| 欧美视频中文字幕| 成人网男人的天堂| 视频在线在亚洲| 国产精品传媒在线| 日韩一级免费观看| 99r精品视频| 久久国产福利国产秒拍| 亚洲欧美日韩一区| 久久综合999| 欧美午夜寂寞影院| 国产盗摄女厕一区二区三区| 午夜不卡在线视频| 亚洲视频免费在线| 国产喷白浆一区二区三区| 欧美一区二区在线免费播放 | 久久久久久一级片| 91精品国产综合久久久久久久| 91影视在线播放|