小编Cos*_*dru的帖子

Franceschini方法如何运作?

维基百科上提到,此方法在O(n log n)时间内对数组进行排序,但它也是稳定且就地的.这听起来像是一个非常好的排序算法,因为没有其他排序算法一次完成所有这些(Insertion Sort不是O(n log n),Heap Sort不稳定,Quicksort(或Introsort)也不是放置或稳定,Mergesort不在位).但是,在维基百科上只提到了它的名字而没有别的.作为参考,它是Franceschini,Gianni(2007年6月1日)."使用O(n log n)比较和O(n)移动稳定地进行排序".计算系统理论40(4):327-353.然而,这并没有真正解释它是如何实际运作的,它更多地说明了它存在的原因.

我的问题是这个方法是如何工作的(它实际上做了什么步骤),以及为什么有这么少的资源与它有关,考虑到没有其他已知的O(n log n)稳定到位的排序方法.

sorting algorithm

10
推荐指数
1
解决办法
2634
查看次数

Java:TextField Listener不起作用

我的代码如下:

package playingwithjava;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
 *
 * @author user
 */
public class Window extends JFrame implements ActionListener{
    //init stuff
    Container ca=getContentPane();
    GridBagLayout gridLayout= new GridBagLayout();
    GridBagConstraints lol=new GridBagConstraints();

    //actual important stuff

    JButton done=new JButton("Done!");
    JTextField text=new JTextField("",25);
    JLabel label=new JLabel("Your name is:");

    public Window(int x,int y)
    {
        super("Playing With Java");
        setSize(x,y);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        ca.setLayout(gridLayout);
        //start of the code
        lol.gridx=0;lol.gridy=0;
        ca.add(label,lol);

        lol.gridx=0;lol.gridy=1;
        text.addActionListener(this);
        ca.add(text,lol);

        lol.gridx=1;lol.gridy=1;
        //done.setEnabled(false);
        done.addActionListener(this);
        ca.add(done,lol);

        //ending
        setContentPane(ca);
        setVisible(true);
    }
    @Override
    public void actionPerformed(ActionEvent event) …
Run Code Online (Sandbox Code Playgroud)

java swing listener

-1
推荐指数
1
解决办法
2127
查看次数

标签 统计

algorithm ×1

java ×1

listener ×1

sorting ×1

swing ×1