├── Images
├── Frame.PNG
└── Main.PNG
├── bin
└── algo_Calc
│ ├── Frame.class
│ ├── heaps.class
│ ├── merg.class
│ ├── quiks.class
│ ├── Frame$1.class
│ ├── Frame$2.class
│ ├── Frame$3.class
│ ├── Frame$4.class
│ ├── Frame$5.class
│ ├── Frame$6.class
│ ├── Frame$7.class
│ ├── Sortingss$1.class
│ ├── Sortingss$2.class
│ ├── Sortingss$3.class
│ ├── Sortingss$4.class
│ └── Sortingss.class
├── src
└── algo_Calc
│ ├── Frame.class
│ ├── heaps.class
│ ├── merg.class
│ ├── quiks.class
│ ├── Frame$1.class
│ ├── Frame$2.class
│ ├── Frame$3.class
│ ├── Frame$4.class
│ ├── Frame$5.class
│ ├── Frame$6.class
│ ├── Frame$7.class
│ ├── Sortingss$1.class
│ ├── Sortingss$2.class
│ ├── Sortingss$3.class
│ ├── Sortingss$4.class
│ ├── Sortingss.class
│ ├── Frame.java
│ └── Sortingss.java
├── .classpath
├── .project
├── .settings
└── org.eclipse.jdt.core.prefs
├── bubble.txt
├── insertion.txt
├── LICENSE
├── selection.txt
├── maxheap.txt
├── quicksort.txt
├── merge.txt
└── README.md
/Images/Frame.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/Images/Frame.PNG
--------------------------------------------------------------------------------
/Images/Main.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/Images/Main.PNG
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame.class
--------------------------------------------------------------------------------
/bin/algo_Calc/heaps.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/heaps.class
--------------------------------------------------------------------------------
/bin/algo_Calc/merg.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/merg.class
--------------------------------------------------------------------------------
/bin/algo_Calc/quiks.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/quiks.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame.class
--------------------------------------------------------------------------------
/src/algo_Calc/heaps.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/heaps.class
--------------------------------------------------------------------------------
/src/algo_Calc/merg.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/merg.class
--------------------------------------------------------------------------------
/src/algo_Calc/quiks.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/quiks.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$1.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$2.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$3.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$4.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$5.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$6.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Frame$7.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Frame$7.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$1.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$2.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$3.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$4.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$5.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$5.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$6.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$6.class
--------------------------------------------------------------------------------
/src/algo_Calc/Frame$7.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Frame$7.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Sortingss$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Sortingss$1.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Sortingss$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Sortingss$2.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Sortingss$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Sortingss$3.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Sortingss$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Sortingss$4.class
--------------------------------------------------------------------------------
/bin/algo_Calc/Sortingss.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/bin/algo_Calc/Sortingss.class
--------------------------------------------------------------------------------
/src/algo_Calc/Sortingss$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Sortingss$1.class
--------------------------------------------------------------------------------
/src/algo_Calc/Sortingss$2.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Sortingss$2.class
--------------------------------------------------------------------------------
/src/algo_Calc/Sortingss$3.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Sortingss$3.class
--------------------------------------------------------------------------------
/src/algo_Calc/Sortingss$4.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Sortingss$4.class
--------------------------------------------------------------------------------
/src/algo_Calc/Sortingss.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/11fenil11/GUI-based-Algorithm-Calculator/HEAD/src/algo_Calc/Sortingss.class
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | algo_Calc
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/bubble.txt:
--------------------------------------------------------------------------------
1 | // Java program for implementation of Bubble Sort
2 | class BubbleSort
3 | {
4 | void bubbleSort(int arr[])
5 | {
6 | int n = arr.length;
7 | for (int i = 0; i < n-1; i++)
8 | for (int j = 0; j < n-i-1; j++)
9 | if (arr[j] > arr[j+1])
10 | {
11 | // swap temp and arr[i]
12 | int temp = arr[j];
13 | arr[j] = arr[j+1];
14 | arr[j+1] = temp;
15 | }
16 | }
17 |
18 | /* Prints the array */
19 | void printArray(int arr[])
20 | {
21 | int n = arr.length;
22 | for (int i=0; i= 0 && arr[j] > key) {
15 | arr[j + 1] = arr[j];
16 | j = j - 1;
17 | }
18 | arr[j + 1] = key;
19 | }
20 | }
21 |
22 | /* A utility function to print array of size n*/
23 | static void printArray(int arr[])
24 | {
25 | int n = arr.length;
26 | for (int i = 0; i < n; ++i)
27 | System.out.print(arr[i] + " ");
28 |
29 | System.out.println();
30 | }
31 |
32 | // Driver method
33 | public static void main(String args[])
34 | {
35 | int arr[] = { 12, 11, 13, 5, 6 };
36 |
37 | InsertionSort ob = new InsertionSort();
38 | ob.sort(arr);
39 |
40 | printArray(arr);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Fenil Parmar
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/selection.txt:
--------------------------------------------------------------------------------
1 | // Java program for implementation of Selection Sort
2 | class SelectionSort
3 | {
4 | void sort(int arr[])
5 | {
6 | int n = arr.length;
7 |
8 | // One by one move boundary of unsorted subarray
9 | for (int i = 0; i < n-1; i++)
10 | {
11 | // Find the minimum element in unsorted array
12 | int min_idx = i;
13 | for (int j = i+1; j < n; j++)
14 | if (arr[j] < arr[min_idx])
15 | min_idx = j;
16 |
17 | // Swap the found minimum element with the first
18 | // element
19 | int temp = arr[min_idx];
20 | arr[min_idx] = arr[i];
21 | arr[i] = temp;
22 | }
23 | }
24 |
25 | // Prints the array
26 | void printArray(int arr[])
27 | {
28 | int n = arr.length;
29 | for (int i=0; i= 0; i--)
10 | heapify(arr, n, i);
11 |
12 | // One by one extract an element from heap
13 | for (int i=n-1; i>=0; i--)
14 | {
15 | // Move current root to end
16 | int temp = arr[0];
17 | arr[0] = arr[i];
18 | arr[i] = temp;
19 |
20 | // call max heapify on the reduced heap
21 | heapify(arr, i, 0);
22 | }
23 | }
24 |
25 | // To heapify a subtree rooted with node i which is
26 | // an index in arr[]. n is size of heap
27 | void heapify(int arr[], int n, int i)
28 | {
29 | int largest = i; // Initialize largest as root
30 | int l = 2*i + 1; // left = 2*i + 1
31 | int r = 2*i + 2; // right = 2*i + 2
32 |
33 | // If left child is larger than root
34 | if (l < n && arr[l] > arr[largest])
35 | largest = l;
36 |
37 | // If right child is larger than largest so far
38 | if (r < n && arr[r] > arr[largest])
39 | largest = r;
40 |
41 | // If largest is not root
42 | if (largest != i)
43 | {
44 | int swap = arr[i];
45 | arr[i] = arr[largest];
46 | arr[largest] = swap;
47 |
48 | // Recursively heapify the affected sub-tree
49 | heapify(arr, n, largest);
50 | }
51 | }
52 |
53 | /* A utility function to print array of size n */
54 | static void printArray(int arr[])
55 | {
56 | int n = arr.length;
57 | for (int i=0; i Array to be sorted,
40 | low --> Starting index,
41 | high --> Ending index */
42 | void sort(int arr[], int low, int high)
43 | {
44 | if (low < high)
45 | {
46 | /* pi is partitioning index, arr[pi] is
47 | now at right place */
48 | int pi = partition(arr, low, high);
49 |
50 | // Recursively sort elements before
51 | // partition and after partition
52 | sort(arr, low, pi-1);
53 | sort(arr, pi+1, high);
54 | }
55 | }
56 |
57 | /* A utility function to print array of size n */
58 | static void printArray(int arr[])
59 | {
60 | int n = arr.length;
61 | for (int i=0; istart)
23 | {
24 | quickSort(num, start, partition - 1);
25 | }
26 | if(partition+1num[largest])
128 | largest = left;
129 |
130 | if (right < size && num[right] > num[largest])
131 | largest = right;
132 |
133 | if (largest != i)
134 | {
135 | int temp;
136 | temp = num[i];
137 | num[i]= num[largest];
138 | num[largest] = temp;
139 | heapify(num, size, largest);
140 | }
141 | }
142 |
143 |
144 | void heapSort(int num[], int size)
145 | {
146 | int i;
147 | for (i = size / 2 - 1; i >= 0; i--)
148 | heapify(num, size, i);
149 | for (i=size-1; i>=0; i--)
150 | {
151 | int temp;
152 | temp = num[0];
153 | num[0]= num[i];
154 | num[i] = temp;
155 | heapify(num, i, 0);
156 | }
157 | }
158 |
159 | }
160 |
161 |
162 | public class Sortingss {
163 |
164 | private JFrame frame;
165 | private JTextField textField;
166 | int key;
167 | String tname = new String();
168 | /**
169 | * Launch the application.
170 | */
171 | public static void main(String[] args) throws Exception{
172 | EventQueue.invokeLater(new Runnable() {
173 | public void run() {
174 | try {
175 | Sortingss window = new Sortingss();
176 | window.frame.setVisible(true);
177 | } catch (Exception e) {
178 | e.printStackTrace();
179 | }
180 | }
181 | });
182 | }
183 |
184 | /**
185 | * Create the application.
186 | */
187 | public Sortingss() {
188 | initialize();
189 | }
190 | public int vis(int k,String str){
191 | key=k;
192 | tname="Hello";
193 | tname="pop";
194 | tname=str;
195 | frame.setVisible(true);
196 | return 0;
197 | }
198 |
199 | /**
200 | * Initialize the contents of the frame.
201 | */
202 |
203 |
204 | private void initialize() {
205 |
206 | frame = new JFrame();
207 | frame.setBounds(100, 100, 514, 329);
208 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
209 | frame.getContentPane().setLayout(null);
210 |
211 | JTextArea textArea_1 = new JTextArea();
212 | textArea_1.setFont(new Font("Arial", Font.BOLD, 26));
213 | textArea_1.setBackground(Color.DARK_GRAY);
214 | textArea_1.setForeground(Color.WHITE);
215 | textArea_1.setBounds(102, 0, 304, 41);
216 | frame.getContentPane().add(textArea_1);
217 |
218 |
219 | textField = new JTextField();
220 | textField.setBounds(102, 102, 304, 22);
221 | frame.getContentPane().add(textField);
222 | textField.setColumns(10);
223 |
224 | JLabel lblEnterInput = new JLabel("Enter Input");
225 | lblEnterInput.setBounds(30, 105, 85, 16);
226 | frame.getContentPane().add(lblEnterInput);
227 |
228 | JTextArea textArea = new JTextArea();
229 | textArea.setLineWrap(true);
230 | textArea.setEditable(false);
231 | textArea.setBounds(102, 175, 304, 56);
232 | frame.getContentPane().add(textArea);
233 |
234 | JButton btnSubmit = new JButton("Submit");
235 | btnSubmit.addActionListener(new ActionListener() {
236 | public void actionPerformed(ActionEvent e){
237 |
238 | String fin = new String();
239 | String str=new String();
240 | str = textField.getText();
241 |
242 | String [] tok = str.split(" ");
243 | int [] num = new int[tok.length];
244 |
245 | for(int i=0;i num[j+1] ) // change to > for ascending sort
260 | {
261 | temp = num[ j ]; //swap elements
262 | num[ j ] = num[ j+1 ];
263 | num[ j+1 ] = temp;
264 | flag = true; //shows a swap occurred
265 | }
266 | }
267 | }
268 | fin = "Bubble Sort =";
269 | }
270 | if(key==2){
271 | int n = num.length;
272 |
273 | // One by one move boundary of unsorted subarray
274 | for (int i = 0; i < n-1; i++)
275 | {
276 | // Find the minimum element in unsorted array
277 | int min_idx = i;
278 | for (int j = i+1; j < n; j++)
279 | if (num[j] < num[min_idx])
280 | min_idx = j;
281 |
282 | // Swap the found minimum element with the first
283 | // element
284 | int temp = num[min_idx];
285 | num[min_idx] = num[i];
286 | num[i] = temp;
287 | }
288 | tname="SELECTION SORT";
289 | fin = "Selection Sort =";
290 | }
291 | if(key==3){
292 |
293 |
294 | quiks obj2 =new quiks();
295 | int size=num.length;
296 | obj2.quickSort(num,0,size-1);
297 | fin="Quick Sort =";
298 | tname="QUICK SORT";
299 | }
300 |
301 | if(key==4){
302 | int i, ke, j;
303 | for (i = 1; i < tok.length; i++)
304 | {
305 | ke = num[i];
306 | j = i - 1;
307 |
308 | /* Move elements of arr[0..i-1], that are
309 | greater than key, to one position ahead
310 | of their current position */
311 | while (j >= 0 && num[j] > ke)
312 | {
313 | num[j + 1] = num[j];
314 | j = j - 1;
315 | }
316 | num[j + 1] = ke;
317 | }
318 | tname="INSERTION SORT";
319 | fin = "Insertion Sort =";
320 | }
321 | if(key==5){
322 | merg obj3=new merg();
323 | int size =num.length-1;
324 | obj3.mergeSort(num, 0, size);
325 | fin ="Merge Sort =";
326 | tname="MERGE SORT";
327 | }
328 |
329 | if(key==6){
330 | heaps obj4=new heaps();
331 | int size;
332 | size=tok.length;
333 | obj4.heapSort(num,size);
334 | fin ="Heap Sort =";
335 | tname="HEAP SORT";
336 | }
337 |
338 | String str1[] =new String[tok.length];
339 | for(int i=0;i