题目内容

对于有N个结点的左偏树,其所有操作(插入/删除最小元/合并)的最坏时间复杂度是Θ(N)。

A. 对
B. 错

查看答案
更多问题

创建子进程,输出各自的PID

打开文件file,在其中写入hello world,然后再将它读出来

父进程PID是7800,子进程PID是7801#include #include #include #include #include int num=0;int main (int argc,char*argv [] ){int var=0;pid_t pid;if ( (pid=_____1_____ ) <0)perror("fork error") ;else if (pid ==0)num = 5;elsesleep(1);printf("pid = %d, num = %d\n",______2______,num);exit(0);}程序输出:______________3___________________________4______________

将子进程写到文件file中的内容读取出来,输出到屏幕上。#include #include #include #include #include #include #include int main(int argc,char* argv[]){pid_t pid;int fd;char * info = "goodbye world";char buf[64] = {0};int nBytes;fd =1;if(fd < 0){perror("open file failed");exit(1);}if((pid =2) < 0){perror("fork error");}else if(pid3){if((nBytes = 4)) < 0){perror("write failed");}exit(0);}else{sleep(1);5;if((nBytes =6)) < 0){perror("read failed");}printf("%s\n",buf);}7;exit(0);}

答案查题题库