04 2019 档案
摘要:Graph There are two standard ways to represent a graph G=(V,E)G=(V,E), where VV is a set of vertices and EE is a set of edges; Adjacency list represen
阅读全文
摘要:Rooted Trees A graph G = (V, E) is a data structure where V is a finite set of vertices and E is a binary relation on Vrepresented by a set of edges.
阅读全文
摘要:软中断信号预置函数为: signal(sig, function) 其中, sig是系统给定的软中断信号中的序号或名称. function是与软中断信号关联的函数名, 当进程在运行过程中捕捉到指定的软中断信号后, 中断当前程序的执行, 转到该函数执行. 注意: 软中断信号必须提前预置, 然后才可以在
阅读全文
摘要:利用系统调用lockf(fd,mode,size),对指定文件的指定区域(由size指示)进行加锁或解锁,以实现进程同步或互斥。其中,fd是文字描述字;mode是锁定方式,=1表示加锁,=0表示解锁;size是指定文件的指定区域,用0表示从当前位置到文件尾
阅读全文
摘要:fork函数被调用一次,能够返回两次,它有三种不同的返回值: 1)在父进程中,fork返回新创建子进程的进程ID; 2)在子进程中,fork返回0; 3)如果出现错误,fork返回一个负值; 在fork函数执行完毕后,如果创建新进程成功,则出现两个进程,一个是子进程,一个是父进程。在子进程中,for
阅读全文
摘要:A priority queue is a data structure which maintains a set SS of elements, each of with an associated value (key), and supports the following operatio
阅读全文
摘要:Search III Your task is to write a program of a simple dictionary which implements the following instructions: insert str: insert a string str in to t
阅读全文
摘要:Write a program which reads a sequence A of n elements and an integer M, and outputs "yes" if you can make M by adding elements in A, otherwise "no".
阅读全文
摘要:Search II You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers i
阅读全文
摘要:Search I You are given a sequence of n integers S and a sequence of different q integers T. Write a program which outputs C, the number of integers in
阅读全文
摘要:Doubly Linked List Your task is to implement a double linked list. Write a program which performs the following operations: insert x: insert an elemen
阅读全文
摘要:There are n processes in a queue. Each process has namei and timei. The round-robin scheduling handles the processes in order. A round-robin scheduler
阅读全文
摘要:Reverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Pol
阅读全文
摘要:#include #include #define N 6 struct PCB { int pid; // 进程标识符 int rr; // 已运行时间 int time; // 进程要求运行时间 char state; // 进程的状态 struct PCB * next; // 链接指针 }; struct PCB pcb[N]; struct PCB *...
阅读全文
摘要:#include #include #include #define N 10 typedef struct table { char name[8]; // 作业名 float in_well; // 进入输入井的时间 float begin_run; // 开始运行时间 float run_time; // 运行时间 float end_run; // 结束运行时间 ...
阅读全文
摘要:Selection Sort Write a program of the Selection Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the follo
阅读全文
摘要:Bubble Sort Write a program of the Bubble Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the following p
阅读全文
摘要:Insertion Sort Write a program of the Insertion Sort algorithm which sorts a sequence A in ascending order. The algorithm should be based on the follo
阅读全文
摘要:Maximum Profit You can obtain profits from foreign exchange margin transactions. For example, if you buy 1000 dollar at a rate of 100 yen per dollar,
阅读全文
摘要:题目描述 定义了Circle圆形类,在此基础上派生出Cylinder圆柱体类。 Circle圆形类定义如下: class Circle { public: Circle(double r):radius(r){ } double area(){return PI*radius*radius;} //
阅读全文
摘要:题目描述 小华历经12寒窗苦读,又经历4年大学磨砺,终于毕业了,随着毕业季的到来,找工作也日益紧张起来。由于要面试不同的公司,因此小华需要准备不同的简历。当然最基本的信息是必不可少的,基本信息:姓名、年龄、性别、专业。现有两家公司,小华想要投简历试一试。第一家langchao公司需要了解小华毕业学校
阅读全文
摘要:题目描述 在一个平面打斗游戏中,任何的角色(Role)都有血量(blood)和位置loc(此处loc是Location类的实例)属性。有了Role类,可以派生出不同的角色,如人、神仙、怪兽等。如下程序中,定义了Location类和Role类,人类(Human)中新增了姓名和攻击力数据成员,请为Hum
阅读全文
摘要:# coding = utf - 8 # 直方图用于那些没有统计过的数据 from matplotlib import pyplot as plt a = [131,98,125,131,124,139,131,117,128,108,135,138,131,102, 97] # 计算组数 d = 3 # 组距 num_bins = (max(a) - min(a)) // d print(...
阅读全文
摘要:# coding = utf - 8 from matplotlib import pyplot as plt a = ["Scarlet ball rise", "spider-man", "Dunkirk", "War Wolf 2"] b_16 = [15746, 312,4497,319] b_15 = [12357,156,2045,168] b_14 = [2358,399,235...
阅读全文
摘要:# coding = utf - 8 from matplotlib import pyplot as plt y_3 = [11,17,16,11,12,11,12,6,6,7,8,9,12] y_10 = [26,26,28,19,21,17,16,19,18,20,19,17,23] x_3 = range(1, 14) x_10 = range(21, 34) # 设置图形大小 p...
阅读全文
摘要:题目描述 引入了const关键词,用于指定“常”对象及“常”对象成员,提供了对数据的一种保护机制,这C++语言的特色之一。但由此,也引出了一些语法上的要求。这些语法要求,实际上有一套完善的原则,需要熟知。 下面的程序,要利用输入的两个数创建一个对象,并调用printxy成员函数输入两数之和。下面的程
阅读全文
摘要:题目描述 定义一个矩形类,数据成员包括左下角和右上角坐标,定义的成员函数包括必要的构造函数、输入坐标的函数,实现矩形加法,以及计算并输出矩形面积的函数。要求使用提示中给出的测试函数并不得改动。 两个矩形相加的规则是:决定矩形的对应坐标分别相加,如 左下角(1,2),右上角(3,4)的矩形,与 左下角
阅读全文
摘要:题目描述 C++时间类的运算符重载 定义一个时间类Time,其数据成员为表示时间的小时(hour)、分(minute),秒(second)。 重载运算符“+”,使之能用于时间对象的加法运算;重载运算符“<<”,使之能用于时间对象的输出操作。 (1)参加运算的两个操作数可以都是时间类对象,也可以其中有
阅读全文