1. 理解稀疏矩阵的设计目的和设计思想；
2.掌握稀疏矩阵存储结构和基本操作的实现方法；
3.思考稀疏矩阵实现数学运算的方法。

1个回答

C++程序设计课程上机实验题

JAVA程序设计基础篇第八版编程题答案

（1）输入10个学生的学号、姓名和成绩，求出其中的高分者和低分者。 #include <stdio.h> struct student { int num; char name[20]; int score; }; int main( ) { int i; struct student st,stmax,stmin; stmax.score=0; stmin.score=100; printf("\n input data"); for(i=0;i<10;i++) { scanf("%d%s%d",&st.num,st.name,&st.score); if(st.score>stmax.score) stmax=st; if(st.score<stmin.score) stmin=st; } printf("\n hight:%5d%15s%5d",stmax.num,stmax.name,stmax.score); printf("\n low:%5d%15s%5d",stmin.num,stmin.name,stmin.score); return 0; } ① 分析程序，上机运行程序。 ② 程序中，哪些是对结构体变量成员的引用？哪些是整体引用？ ③ 对于此例来说，用结构体变量作为数据结构有何优越性

（1）以整型数（int）为基础，设计任意长度整数的大整数运算系统（记为MyBigInt）。 （2）以上述的MyBigInt型整数运算系统为基础，设计以MyBigInt型整数为系数的多项式运算系统（记为MyPolyBigInt）。 （3）以MyPolyBigInt为基础，设计有理分式运算系统(记为MyRatPolyBigInt)要求完成: A. ADT设计； B. 选择合适的存储结构； C. 关键算法的设计； D. 基于Java interface的ADT表示 （上机完成）； E. 基于Java class的具体实现（上机完成）。 。

You are to find the closest common ancestor of two vertices in a binary tree. For example, the common ancestors of vertices 8 and 13 in the figure below are vertices 3 and 1. Among them, vertex 3 is the closest to the vertex 8 and 13. And the size of sub-tree (the number of vertices in the sub-tree) rooted by vertex 3 is 8.![图片说明](https://img-ask.csdn.net/upload/201706/18/1497782587_428418.jpg) Given a binary tree and two vertices, write a program that finds the closest common ancestor and computes the size of the sub-tree rooted by the closest common ancestor. No input is given where one of the two given vertices is an ancestor of the other. For example, ‘11 and 3’ in the above tree is an invalid input. Therefore, your program does not have to consider this case. [Constraints] The number of vertices are from 3 to 10000 [Input] You are given 10 test cases. Each test case has two lines, so the total number of lines is 20. In each test case, the first line consists of four integers, V (the number of vertices in the tree), E (the number of edges), and the indices of two vertices. E edges are listed in the next line. Each edge is represented by two vertices; the index of the parent vertex always precedes the index of the child. For example, the edge connecting vertices 5 and 8 is represented by “5 8”, not by “8 5.” There is no order in which the edges are given. Every consecutive integer in the input is separated by a space. Given 10 test cases, First 4 test cases contain small number of vertices(3, 5, 7, 10 each). Next 6 test cases contain same or greater than 50 vertices. The indices of vertices are integers from 1 to V, and root vertex always has the index 1. It is guaranteed that the parent vertex has smaller index than the child vertex. In this problem, it is not important whether the child is the left child of the parent or the right child; so you can decide this arbitrarily. [Output] Output 10 answers in 10 lines. Each line starts with ‘#x’ meaning the index of a test case, and writes the answer after a space. The answer has two integers: the index of the closest common ancestor and the size of the sub-tree rooted by the closest common ancestor. These two integers are separated by a space as well. [I/O Example] Input (20 lines in total) 13 12 8 13 ← Start of the first input 1 2 1 3 2 4 3 5 3 6 4 7 7 12 5 9 5 8 6 10 6 11 11 13 10 9 1 10 ← Start of the second input 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 ... Output (10 lines in total) #1 3 8 #2 1 10 ...

``` a+b*(c-d)-e/f ``` 的先序是 ``` -+a*b-cd/f ``` 请问这是如何推到出来的呢？ 先序，我个人认为是把运算符都放最前面，但是并没有那样，字母中间还放了一些，迷茫，求解

; ----------框架----------- include io32.inc .data ; 数据定义 N = 10 source byte 0feh,90h,0ffh,0ddh,0e0h,97h,61h,4ah,39h,30h result byte N*2 dup(0) .code start: ; 主程序 lea esi,source mov edi,offset result cld mov edx,N lp1: mov AL,[esi] mov [edi],al mov ecx,8 mov dh,0 lp2:shl al,1 jc lp3 inc dh lp3: loop lp2 inc edi mov [edi],dh inc esi dec dl jnz lp1 ;==================== mov ecx,N lea esi,result disp: lodsb call disphb mov al,' ' call dispc loop disp exit 0 ; 子程序 end start

Problem Description You have a computer literacy course in your university. In the computer system, the login/logout records of all PCs in a day are stored in a file. Although students may use two or more PCs at a time, no one can log in to a PC which has been logged in by someone who has not logged out of that PC yet. You are asked to write a program that calculates the total time of a student that he/she used at least one PC in a given time period (probably in a laboratory class) based on the records in the file. The following are example login/logout records. * The student 1 logged in to the PC 1 at 12:55 * The student 2 logged in to the PC 4 at 13:00 * The student 1 logged in to the PC 2 at 13:10 * The student 1 logged out of the PC 2 at 13:20 * The student 1 logged in to the PC 3 at 13:30 * The student 1 logged out of the PC 1 at 13:40 * The student 1 logged out of the PC 3 at 13:45 * The student 1 logged in to the PC 1 at 14:20 * The student 2 logged out of the PC 4 at 14:30 * The student 1 logged out of the PC 1 at 14:40 For a query such as "Give usage of the student 1 between 13:00 and 14:30", your program should answer "55 minutes", that is, the sum of 45 minutes from 13:00 to 13:45 and 10 minutes from 14:20 to 14:30, as depicted in the following figure. Input The input is a sequence of a number of datasets. The end of the input is indicated by a line containing two zeros separated by a space. The number of datasets never exceeds 10. Each dataset is formatted as follows. N M r record1 ... recordr q query1 ... queryq 　 　 The numbers N and M in the first line are the numbers of PCs and the students, respectively. r is the number of records. q is the number of queries. These four are integers satisfying the following. 1 ≤ N ≤ 1000, 1 ≤ M ≤ 10000, 2 ≤ r ≤ 1000, 1 ≤ q ≤ 50 　 Each record consists of four integers, delimited by a space, as follows. t n m s s is 0 or 1. If s is 1, this line means that the student m logged in to the PC n at time t . If s is 0, it means that the student m logged out of the PC n at time t . The time is expressed as elapsed minutes from 0:00 of the day. t , n and m satisfy the following. 540 ≤ t ≤ 1260, 1 ≤ n ≤ N , 1 ≤ m ≤ M You may assume the following about the records. # Records are stored in ascending order of time t. # No two records for the same PC has the same time t. # No PCs are being logged in before the time of the first record nor after that of the last record in the file. # Login and logout records for one PC appear alternatingly, and each of the login-logout record pairs is for the same student. 　 　 Each query consists of three integers delimited by a space, as follows. ts te m It represents "Usage of the student m between ts and te ". ts , te and m satisfy the following. 540 ≤ ts < te ≤ 1260, 1 ≤ m ≤ M Output For each query, print a line having a decimal integer indicating the time of usage in minutes. Output lines should not have any character other than this number. Sample Input 4 2 10 775 1 1 1 780 4 2 1 790 2 1 1 800 2 1 0 810 3 1 1 820 1 1 0 825 3 1 0 860 1 1 1 870 4 2 0 880 1 1 0 1 780 870 1 13 15 12 540 12 13 1 600 12 13 0 650 13 15 1 660 12 15 1 665 11 13 1 670 13 15 0 675 11 13 0 680 12 15 0 1000 11 14 1 1060 12 14 1 1060 11 14 0 1080 12 14 0 3 540 700 13 600 1000 15 1000 1200 11 1 1 2 600 1 1 1 700 1 1 0 5 540 600 1 550 650 1 610 620 1 650 750 1 700 800 1 0 0 Sample Output 55 70 30 0 0 50 10 50 0

![图片说明](https://img-ask.csdn.net/upload/201603/23/1458705597_655091.png) #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> void main() { char str[1024]; int num[1024] = {0}; scanf("%s", str); for (int i = 0; i < strlen(str); i++) //判断是否除了字母以外还有其他字符如果有则删去 { while (str[i]<'A' || str[i]>'z' ) { for (int j = i; j < strlen(str); j++) { str[j] = str[j + 1]; } if (str[i] == '\0') { break; } } } int i = 0; while (str[i]!='\0') { int count = 1; int j = i; while (str[j] == str[j + 1]) { count++; j++; } num[i] = count; printf("%c", str[i]); printf("%d", num[i]); i += count; } //printf("%s", str); system("pause"); } ![图片说明](https://img-ask.csdn.net/upload/201603/23/1458705615_423025.png)

B2(2分,读写文件各1分) 完成下面文件操作的练习 public class Test { public static void main(String[] asdfasdfas) throws Exception { File f = new File("d:/test.txt"); createFile(f); readFile(f); } public static void readFile(File f) {// 读出文件f的内容,并打印出 } public static void createFile(File f) {// 向文件f中写入三行任意的字符串 } }

r语言上机题，关于优劣度的排序，一直等于0，快疯了

x<-matrix(sample(1:10,size=36,replace=T),6,6) max=numeric(6) min=numeric(6) for(k in 1:6){ max[k]=max(x[k,]) min[k]=min(x[k,]) } sum1=0 sum2=0 for(i in 1:6) { for(j in 1:6) { if(j==1||j==3||j==6) { sum1=sum1+(x[i][j]-max[i])^2 sum2=sum2+(x[i][j]-min[i])^2 } else { sum1=sum1+(x[i][j]-min[i])^2 sum2=sum2+(x[i][j]-max[i])^2 } } js=numeric(6) sum1=sqrt(sum1) sum2=sqrt(sum2) js[i]=as.double(sum2)/(sum1+sum2) sum1=0 sum2=0 } 输出结果js全是000000，做的实验是比较无纲量化处理再比较优劣度

MySQL数据库面试题（2020最新版）

2020阿里全球数学大赛：3万名高手、4道题、2天2夜未交卷

HashMap底层实现原理，红黑树，B+树，B树的结构原理 Spring的AOP和IOC是什么？它们常见的使用场景有哪些？Spring事务，事务的属性，传播行为，数据库隔离级别 Spring和SpringMVC，MyBatis以及SpringBoot的注解分别有哪些？SpringMVC的工作原理，SpringBoot框架的优点，MyBatis框架的优点 SpringCould组件有哪些，他们...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版（进大厂必备）

《Oracle Java SE编程自学与面试指南》最佳学习路线图（2020最新版）

2020春招面试了10多家大厂，我把问烂了的数据库事务知识点总结了一下

2020年截止目前，我面试了阿里巴巴、腾讯、美团、拼多多、京东、快手等互联网大厂。我发现数据库事务在面试中出现的次数非常多。