Simplify the following Boolean expression
!((i ==12) || (j > 15))
struct Node {
int value;
Node* next;
};
1.1 Get the value of the Nth node from last node in the linked list.
PARAM HEAD: the first element in the linked list:
PARAM n: the number of the node counted reversely
RETURN: the value of the node, or -1 if not exists
int GetValue(Node* HEAD, int n)
{
}
1.2 Delete a node WITHOUT using the HEAD pointer.
PARAM p: A pointer pointed to a node in the middle of the linked list.
RETURN: void
void Delete(Node* p)
{
}
1.3 Insert a new node before p WITHOUT using the HEAD pointer
PARAM p: A pointer pointed to a node in the middle of the linked list.
PARAM value: new Node value
RETURN: void
void Insert(Node* p, int value)
{
}
Question 2:
Please write a String class with following features:
第1题:
12、设i、j、k均为int型变量,则执行完下面的for循环后,k的值为()。 for (i=0,j=10;i<=j;i++,j--) k=i+j ;
第2题:
设 i,j,k 均为 int 型变量 , 则执行完下面的 for 循环 后 ,k 的值为 for(i=0,j=10;i<=j;i++,j--) k=i+j 设i,j,k均为int型变量,则执行完下面的for循环后, k的值为 i=0; for(j=10;i<=j;i++) { k=i+j; j=j-1;}
A.10
B.可以去调试来理解这个结果
C.9
D.11
E.12
第3题:
boolean和int之间不能相互赋值
第4题:
12、若i,j已定义成int型,则以下程序段中,内循环体的总执行次数是(). for(i=6;i>0;i--) for(j=0;j<4;j++) {…}
A.30
B.20
C.24
D.25
第5题:
15、若i、j已定义成int型,则以下程序段中内循环体的总执行次数是()。 for(i=6;i>0;i--) for(j=0;j<4;j++){…}
A.20
B.24
C.25
D.30