高分求解(150分)C問題(英語的)

時間 2021-10-14 23:06:07

1樓:

//這題的意思是說叫你設計一種資料結構,能夠支援插入乙個數,取這一堆數中的最大值和最小值,最大值最小值取出之後,這個值就不存在了

//這題可以用線段樹來做的,他支援插入,取最大,取最小,操作的複雜度是o(log(n))

#include

#include

const int max=100005;//假設你的數字是在0-100000之間的

struct tree

}node[max*4];

int cnt=0;//記錄數中數字的總個數

void clr(int l,int r,int tag)

clr(l,mid,tag<<1);//清空左子樹

clr(mid,r,(tag<<1)+1);//清空右子樹

}void ins(int id,int tag)

node[tag].min=node[tag<<1].min;

if(node[(tag<<1)+1].min

}int main()

else if(cmd==2)

printf("%d\n",node[1].max);//輸出當前最大值

del(node[1].max,1);//刪除值

cnt--;

}else if(cmd==3)

cnt--;

printf("%d\n",node[1].min);//輸出當前最小值

del(node[1].min,1);//刪除}}

return 0;}

2樓:匿名使用者

since queue elements may only be removed from the front, it does not match the delete_maximum. thus, we do not consider queue data structure. also, stack has the same issue.

thus, we do not suggest both stack and queue. then only array-based list and linked list are left. since the performance of the two deletion operations are critical, finally i suggest linked list.

time complexity for insert is theta(1).

time complexity for delete_maximum is theta(n). although time complexity for delete is theta(1), but we need to find the maximum, which will require theta(n). in total, the time complexity is theta(n).

similarly, time complexity for delete_minimum is theta(n).

3樓:

你是 不會 翻譯呢? 還是 不會做題呢?

沒用 標準答案, 只是讓你 提個 思路

高分求解一c++題

4樓:

#include

#include

#include

/*生成乙個空白字串

string :字串,

n :為空白字串的長度(空格符的個數)。

返回值為指向string的指標

*/ char *mystrspc(char *string,int n)

return string;

} int main(int argc, char *ar**)return 0;}

5樓:

c90標準的:

char *mystrspc(char *string, int n)

c99的:

char *mystrspc(char *string, int n)

6樓:匿名使用者

#include

char *mystrspc(char *string,int n)

main()

7樓:

char * mystrspc(char * string, int n)

高分求解英語課程轉讓的問題,急!!!高分求解英語問題!!!

我不能全部回答你的問題,因為我認為韋伯和英孚都是廣告比實際好幾十倍,不怎麼感興趣。但是看見沒有人回答,所以進來發個言 我只知道一個事情,就是最近不讓轉讓,那麼就有人什麼手續都不辦然後直接私下交易並頂替。有點像賣黃牛票的感覺。具體費用問題,等高手來回答吧,祝你好運 金色的土塊 1。英孚的很多外教,國籍...

高分求解感情問題!我的未來,高分求解!!! 戀愛問題 。男朋友嫌我煩,怎麼辦?

google來踩場 你的未來不在別人的嘴裡,而是在你的手裡,好好努力吧!其實問題很簡單,如果你不愛她,那就放了她吧,女人的青春是有限的,不要耽誤了她的青春,讓真正愛她的人來珍惜她。但如果你愛她,那當然要和她在一起,而且要儘自己最大的努力給她幸福。沒有人能阻止你們相愛,能讓你們分開的人,就只有你們自己...

初中的英語題目!高分求, 高分求解 初中英語選擇題

雨中de桔梗花 你有的有序號有的序號不對,還有沒選項的,我只能按順序做了.我也不標題號.c 可以,請便 b 當然可以.用a回答很生硬,而且這樣的回答往往是針對他問你有沒有能力做某事吧.yes,he is d keep doing.spell the words in french變為過去分詞 表被動...