# 分治法思想-求顺序表中的最大值

```python
def get_max(arr):
#     当长度<=2时
    return max(arr)

def solve(init_list):
    n=len(init_list)
    if n<=2:
        return get_max(init_list)
#     递归拆分
    left_list,right_list=init_list[:n//2],init_list[n//2:]
#     求左右两边最大值
    left_max,right_max=solve(left_list),solve(right_list)
#     合并求最大值
    return get_max([left_max,right_max])

data=[12,3,5,77,4,9,23,56,35,8]
print(solve(data))

#77
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/shua-ti/si-xiang-lei/fen-zhi-fa/qiu-shun-xu-biao-zui-da-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
