(5 Points)
A、Improve memory access pattern to decrease cache misses.
B、Use special instructions(e.g. vector instructions) to replace compiler generated assembly code.
C、Change an algorithm from recursive implementation to iterative implementation.
D、Loop unwinding.
16、Which regular expression(s) matches the sentence "www.microsoft.com" ? (5 Points)
A、^\w+\.\w+\.\w+$
B、[w]{0,3}.[a-z]*.[a-z]+
C、.[c-w.]{3,10}[.][c-w.][.][a]|.+
D、[w][w][w][microsoft]+[com]+
E、\w*
17、In the image below , if the function is designed to multiply two positive numbers which line number in the image contains the biggest functional bug(assume no overflow)?
(5 Points)
A、Line 1
B、Line 2
C、Line 3
D、Line 4
E、Line 5
18、Which of the following can be referred to as attack method(s)?
Select all that apply.(5 Points)
A、Vulnerability scan
B、SQL Injection
C、Drive-by downloading
D、Brute force
19、A table CANNOT have one or more of the following index configurations.(5 Points)
A、No indexes
B、A clustered index
C、clustered index and many non-clustered indexes
D、Many clustered index
20、Which of the following is(are) true about providing security to database servers ? Select all that apply.(5 Points)
A、Do not host a database server on the same server as your web server
B、Do not host a database server on a server based system
C、Do not use blank password for SA account
D、Employ a centralized administration model
第二部分測试时间为60分钟。满分50分。请务必在回答问题前细致阅读变成题目。您能够选用C、C++、C#或者Java 当中不论什么一种编程语言。而且保证您的代码能够正确编译和有正确的结果。另外,请一定要注意您的代码的质量。
21、Given a singly linked list L: (L0 , L1 , L2...Ln-1 , Ln). Write a program to reorder it so that it becomes(L0 , Ln , L1 , Ln-1 , L2 , Ln-2...).
Notes:
1、Space Complexity should be O(1)
2、Only the ".next" field of a node is modifiable.
代码:
转载请标明出处。原文地址: struct Node { int val_; Node* next; }; //将链表分成前后两部分。前一个链表长度 >= 后一链表长度 Node* list_half(Node* head) { Node* half = NULL; Node* fast = head, *slow = head; while(fast && fast->next && fast->next->next) { slow = slow->next; fast = fast->next->next; } if(slow) { half = slow->next; slow->next = NULL; } return half; } //反转后一个链表 Node* list_reverse(Node* head) { if(NULL == head) return NULL; Node* prev, *curr, *reverse_head, *temp; prev = NULL, curr = head; while(curr->next) { temp = curr->next; curr->next = prev; prev = curr; curr = temp; } curr->next = prev; reverse_head = curr; return reverse_head; } //合并两个链表 Node* list_merge(Node* first, Node* second) { Node* head = first; Node* temp; while(second) { temp = first->next; first->next = second; second = second->next; first->next->next = temp; first = temp; } return head; } Node* list_reorder(Node *head) { Node* half = list_half(head); Node* half_head = list_reverse(half); head = list_merge(head, half_head); return head; }