如何在java脚本中执行冒泡排序程序 [英] How to do bubble sort program in java script

查看:590
本文介绍了如何在java脚本中执行冒泡排序程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Write a javascript program in a file named bubble.html
This file should contain a text box named mydata that collects the numbers separated by commas.

A button named "databtn" is used to invoke a javascript function named bubble_sort().This function does not accept any arguments.
The data must be sorted

What I have tried:

<pre><!DOCTYPE html>
<html>
<body>
    <form>
         Enter data to sort: <input type=text name=mydata id=mydata>
    <input type=button name=databtn value="Sort Data" onclick="bubble_sort()">
    </form>
    <script>
        function bubble_sort()
        {
            var data=(document.getElementById('mydata').value);
            int len=data.length;
            alert(len);
        }
    </script>
   
</body>
</html>

推荐答案

引用:

如何在java脚本中执行冒泡排序程序

How to do bubble sort program in java script



严重吗?你的主要工作就是粘贴你的作业!

你想要的帮助就是我们做你的作业,因为你是一个新手。

它和你一个人在一起训练一样高效为了打败奥运会纪录。



1)学习Javascript

2)在网上搜索冒泡排序算法并研究它,做在一张纸上的一些例子。

3)编写你的程序



我们不做你的HomeWork。

HomeWork不会在乞求其他人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及你在应用它们时遇到的问题。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

你的任何失败都会帮助你了解什么有效,什么无效,被称为'试错'学习。

所以,试一试,重读课程并开始工作。如果您遇到特定问题,请展示您的代码并解释这个问题,我们可能会提供帮助。


Seriously ? your main effort is pasting your assignment!
the help your want is us doing your homework because you are a newbie.
It is as efficient as having someone training for you in order to beat an Olympic record.

1) learn Javascript
2) search internet for "Bubble Sort" algorithm and study it, do some examples on a sheet of paper.
3) write your program

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.


这篇关于如何在java脚本中执行冒泡排序程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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