当前位置: 首页 > 问题分类 > 计算机类考试 > 软考中级 > 问题详情
问题

● 给定一组长度为n的无序序列,将其存储在一维数组a[0..n-1]中。现采用如下方法找出其中的最大元素和最小元素:比较 a[0]和 a[n-1],若 a[0]较大,则将二者的值进行交换;再比较a[1]和a[n-2],若a[1]较大,则交换二者的值;然后依次比较a[2]和a[n-3]、a[3]和 a[n-4]、…,使得每一对元素中的较小者被交换到低下标端。重复上述方法,在数组的前 n/2 个元素中查找最小元素,在后 n/2 个元素查找最大元素,从而得到整个序列的最小元素和最大元素。上述方法采用的算法设计策略是 (64) 。

(64)

A. 动态规划法

B. 贪心法

C. 分治法

D. 回溯法

参考答案
正确答案:C
您可能感兴趣的试题
  • 某局域网通过两个路由器划分为3个子网,拓扑结构和地址分配如图5-1所示。

    下面是路由器R1的配置命令列表,在空白处填写合适的命令/参数,实现R1的正确配置。

    Router>en

    Router>conf term

    Router(config)hostname R1 (1)

    R1(config-if)ip address 192.168.1.2 255.255.255.0

    R1(config-if)no shutdown

    R1(config-if)int s0

    R1(config-if)ip address (2)

    R1(config-if)no shutdown

    R1(config-if)clock rate 56000

    R1(config-if)exit

    R1(config)ip routing

    R1(config)ip route 0.0.0.0 0.0.0.0 (3)

    R1(config)ip classless

    R1(config)exit

    R1copy run start

  • 从供选择的答案中选出应填入英语文句中()的正确的答案。

    Applications put computers to practical business (A), but below the (B) it's the heart of an operating system the kernel that provides the technical wizardry to juggle multiple program, connect to networks and store (C) .

    A traditional kernel provides all the functions for applications. The kernel (D) memory, I/O devices and parcels out processor time.

    The kernel also supports security and fault (E), which is the ability to recover automatically when parts of the system fail.

    A: ① used ② use ③ apply ④ applied

    B: ① earth ② bottom ③ table ④ surface

    C: ① graphics ② data ③ text ④ image

    D: ① manages ② manage ③ managed ④ managing

    E: ① error ② question ③ tolerance ④ problem

  • 从供选择的答案中选出应填入英语文句中()的正确的答案。

    Toolboxes and menus in many application programs were (A) for working with the mouse. The mouse controls a pointer on the screen. You move the pointer by (B) the mouse over a flat surface in the direction you want the pointer to move. If you run out of (C) to move the mouse, lift it up and put it down again. The pointer moves only when the mouse is (D) the flat surface. Moving the mouse pointer across the screen does not affect the document, the pointer simply (E) a location on the screen. When you press the mouse button, something happens at the location of the pointer.

    A: ① assigned ② designed ③ desired ④ expressed

    B: ① putting ② sliding ③ serving ④ taking

    C: ① board ② place ③ room ④ table

    D: ① getting ② going ③ teaching ④ touching

    E: ① constructs ② indicates ③ instructs ④ processes

  • 从供选择的答案中选出应填入英语文句中()的正确的答案。

    PCs originated as stand-alone (A), however, in recent years many have been (B) to Local Area Networks (LANs). In a LAN, the data and usually the user application reside on the File Server, a PC running a special Network Operating System (NOS) such as Novell's NetWare or Microsoft's LAN Manager. The File Server manages the LAN users' shared access to data on its hard (C) and frequently provides access to other shared resources, such as printers. While a LAN enables users of PC-based databases to share (D) data files, it doesn't significantly change how the DBMS works; all the actual data (E) is still performed on the PC running the database application.

    A~E: ① calculating ② common ③ connected ④ disks

    ⑤ displayed ⑥ systems ⑦ primers ⑧ processing

    ⑨ some ⑩ workstations