備戰秋招 堆排序

2021-10-08 23:08:07 字數 948 閱讀 2995

public

class

heapsort

//交換heap堆中i索引和j索引處的值

private

static

void

exch

(comparable[

] heap,

int i,

int j)

//根據原陣列source,構造出堆heap

private

static

void

createheap

(comparable[

] source, comparable[

] heap)

}//對source陣列中的資料從小到大排序

public

static

void

sort

(comparable[

] source)

//把heap中的資料複製到原陣列source中

system.

arraycopy

(heap,

1,source,

0,source.length);}

//在heap堆中,對target處的元素做下沉,範圍是0~range

private

static

void

sink

(comparable[

] heap,

int target,

int range)

else

}else

//2.比較當前結點的值和較大子結點的值if(

!less

(heap,target,max)

)exch

(heap,target,max)

; target = max;}}

}

備戰秋招 vlan

答 洪範範圍 讓pc1發廣播包,在其他pc上抓包,如果能夠抓到來自pc1的包則在同一廣播域 當交換機的介面被劃入vlan後,只會洪氾至相同vlan的介面 基於資料幀中的目標mac位址,來查詢本地的mac位址表,之後基於表中的記錄單播 到對應的介面中 資料幀進入交換機時,首先檢視源mac,然後將對應的...

秋招 SQL備戰練習3

續接前兩篇部落格秋招 sql備戰練習1 秋招 sql備戰練習2 用到的資料庫表如下 employees test create table employees test id int primary key not null,name text not null,age int not null,a...

2021秋招備戰 MySQL面試相關知識

事務時訪問並可能更新資料庫中各種資料項的乙個程式執行單元。是乙個完整的業務邏輯單元事務不可以再分割 和事務相關的語句只有dml語句。資料庫主要分為五大模組 1.dql 資料查詢語言 凡是select語句都是 2.dml 資料操作語言 對錶內的資料進行增 刪 改 3.ddl 資料定義語言 庫和表的定義...