堆排序无视觉基础 [英] heap sorting unsing visual basic

查看:74
本文介绍了堆排序无视觉基础的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在处理数组排列的同时,我要使用堆排序进行搜索.请输入代码或程序.

please i''m working on an array arrangement, while i am to search using heap sorting. pls i need the code or program.

推荐答案

排序是在框架中构建的,不需要自己编写.为此使用Array.Sort.

Sorting is built in the framework there is no need to write your own. Use Array.Sort for this.

Dim x As Integer
Dim names(3) As String
names(0) = "Howard, Ryan"
names(1) = "Allen, Ray"
names(2) = "Peter, Albert"
names(3) = "Ingrid, Allen"
For x = 0 To (names.Length - 1)
   Console.WriteLine(CStr(x) + ". " + names(x).ToString())
Next x
Array.Sort(names)
For x = 0 To (names.Length - 1)
   Console.WriteLine(CStr(x) + ". " + names(x).ToString())
Next x


这篇关于堆排序无视觉基础的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆