Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace quicksort_test
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- int r = 20;
- int[] container = new int[20];
- private void button1_Click(object sender, EventArgs e)
- {
- listBox1.Items.Clear();
- for (int i = 0; i < r; i++)
- {
- listBox1.Items.Add(Modnar.willekeurig());
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- // the items in array container will be divided in two arrays,
- // and in those arrays they will be divided again in two arrays
- int[] klein;
- int[] groot;
- int kk = 0;
- container = new int[listBox1.Items.Count];
- for (int i = 0; i < container.Length; i++)
- {
- container[i] = Convert.ToInt32(listBox1.Items[i]);
- }
- int gemiddelde = container.Sum() / container.Length;
- for (int j = 0; j < container.Length; j++)
- {
- if (container[j] < gemiddelde)
- {
- kk++;
- }
- }
- klein = new int[kk];
- groot = new int[container.Length - kk];
- }
- }
- }
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace quicksort_test
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- int r = 20;
- int[] container = new int[20];
- private void button1_Click(object sender, EventArgs e)
- {
- listBox1.Items.Clear();
- for (int i = 0; i < r; i++)
- {
- listBox1.Items.Add(Modnar.willekeurig()); //Add random to listbox
- container[i] = Convert.ToInt32(listBox1.Items[i]);//Imidiatly put them in array
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- int[] klein; // the items in array container will be divided in two arrays,
- int[] groot;
- int kk = 0;
- int gemiddelde = container.Sum() / container.Length;
- for (int j = 0; j < container.Length; j++)
- {
- if (container[j] < gemiddelde)
- {
- kk++;
- }
- } // and in those arrays they will be divided again in two arrays
- klein = new int[kk];
- groot = new int[container.Length - kk];
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement