]; atFront = 0; -Rear =-1; -Items = 0; - } - - //Enter the team--first add to take in Public voidInsertLongkey) { - if(Rear = = MaxSize-1){ toRear =-1; + } -Arr[++rear] =key; theitems++; * } $ Panax Notoginseng //out of the squad--first in the plus 1 . - Public LongRemove () { the Longnum = arr[front++]; + if(Front = =maxSize) { AFront = 0; the } +items--; - returnnum; $ } $ - //Get Team head - P
Author Informationwrite in front
Gossip don't want to say more, and then summarize, today is the sparse matrix ternary storage of the order structure.
Text Description
first, the noun explanation
1. Sparse matrix
Less than 0 elements in matrix
} + A the intByte_int =Testbyte.byte_int (int_byte); +System.out.println ("byte_int); - $ } $}Let's go first. x0ff 16 binary to binary is 11111111 Bitwise AND operatorTwo operand median is 1 and result is 1If two operations are bit one 1 another 0, the result is 0That is, the arithmetic rule:00=0; 01=0; 10=0; 11=1;Here the main role is to clear 0, take a number of the middle finger positioningWhen we convert the ID into binary, we can move a few 8
// Sparse matrix multiplication (ternary Array Storage) 1240# Include # Include
Typedef struct{Int R;Int C;Int V;} Spnode;
Typedef struct{Int Mu, nu, Tu;Spnode data [7001];} Spmatrix;
Int num [10001], rpot [10001];Spmatrix * a, * B, * C;
Void num_rpot (){Int I, J;For (I = 0; I Num [I] = 0;For (I = 1; I {J = B-> data [I]. R;Num [J] ++;}Rpot [0] = 1;For (I = 1; I Rpot [I] = rpot [I-1] + num [I-1];}
Int main
#include using namespace Std;#define MAXSIZE 100Class Qune{Publicint data[maxsize];int front;int rear;};void Qinsert (Qunea,int x); Teamint Qdelete (QUNEA); Out Teamint main (){Qune A;A.front = A.rear =-1; Initializing an empty queue}void Qinsert (Qunea,int x){if ((a.rear + 1)% Maxsize = = A.front) {//To determine the queue is full, the maximum number of elements in the queue storage is Maxsize-1cout return;}A.rear = (a.rear + 1)% Maxsize; Loop queue,
integers per line, a, B. Indicates that course a is a pre-set course for Course B.Output1th.. T line: 1 strings per line, if the group information is correct, output "Correct", if the group information is wrong, output "wrong".
Sample input
22 21 22 13 21 21 3
Sample output
wrongcorrect algorithm analysis: The idea of topological sequencing is very easy to implement code, this does not describe the implementation of topological
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.