Ask your own question, for FREE!
Computer Science 6 Online
OpenStudy (ajprincess):

Pls help:)

OpenStudy (ajprincess):

say there is a while loop containing statements asking for user input. if the user enters the same input for successive iterations the loop should exit.How to do that?

OpenStudy (ajprincess):

@annas

OpenStudy (ajprincess):

@ganeshie8

ganeshie8 (ganeshie8):

pseudo code : ``` string prev = NULL; string input; while (1) { scanf("%s", input); if(input =~ prev) { return; }else { prev = input; #do watever u want } } ```

ganeshie8 (ganeshie8):

just declare another variable and save the input everytime, and compare it wid previous input when u find they're same, exit

ganeshie8 (ganeshie8):

should be simple, eh ?

OpenStudy (ajprincess):

ya I guess so:)

ganeshie8 (ganeshie8):

:) it is simple, just dive in and write the code :) good luck !

ganeshie8 (ganeshie8):

u doing it in c ha ?

OpenStudy (ajprincess):

no I am doing it in java. thnx.:)

ganeshie8 (ganeshie8):

ohk... :)

ganeshie8 (ganeshie8):

you looking for exact syntax of code is it

OpenStudy (ajprincess):

I am trying it using the pseudo code u gave.:)

ganeshie8 (ganeshie8):

kk :3

OpenStudy (ajprincess):

what should I do if this comes in a method with a return statement.

OpenStudy (ajprincess):

that's k. I used break. works fine.:)

ganeshie8 (ganeshie8):

very nice :) may i see the code ha

OpenStudy (ajprincess):

ya sure.:) `char p=0; while(j<3) { System.out.println("Choose one of the following types of data sets"); System.out.print("a.Random array\nb.Sorted array\nc.Reversed array\n"); System.out.print("Enter the data type: "); char dataType=s.next().charAt(0); int i=0; if(dataType==p) { return ; } else { p=dataType; switch(dataType) { case 'a': System.out.print("Random array is: "); print(a); d=selectAlgoType(A,A1,A2,A3,A4); System.out.println("Histogram of random array sorted using different sorting techniques"); histogram(d); break; case 'b': System.out.print("Sorted array is: "); print(b); d=selectAlgoType(B,B1,B2,B3,B4); System.out.println("Histogram of sorted array sorted using different sorting techniques"); histogram(d); break; case 'c': System.out.print("Reversed array is: "); print(c); d=selectAlgoType(C,C1,C2,C3,C4); System.out.println("Histogram of reverse ordered array sorted using different sorting techniques"); histogram(d); break; default: System.exit(0); } } j++; }`

OpenStudy (ajprincess):

`public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; while(j<5) { algoType=getAlgoType(); if(algoType==prev) { break; } else { prev=algoType; switch(algoType) { case 1: startTime=getTime(); selectionSort(a); endTime=getTime(); System.out.println("Time taken for selection " + "sort of reverse ordered array: "+computationTime(startTime,endTime)); d[0]=computationTime(startTime,endTime); break; case 2: startTime=getTime(); bubbleSort(a1); endTime=getTime(); System.out.println("Time taken for bubble " + "sort of reverse ordered array: "+computationTime(startTime,endTime)); d[1]=computationTime(startTime,endTime); break; case 3: startTime=getTime(); insertionSort(a2); endTime=getTime(); System.out.println("Time taken for insertion " + "sort of reverse ordered array: "+computationTime(startTime,endTime)); d[2]=computationTime(startTime,endTime); break; case 4: startTime=getTime(); mergeSort(a3,0,a3.length-1); endTime=getTime(); System.out.println("Time taken for merge " + "sort of reverse ordered array: "+computationTime(startTime,endTime)); d[3]=computationTime(startTime,endTime); break; case 5: startTime=getTime(); quickSort(a4,0,a4.length-1); endTime=getTime(); System.out.println("Time taken for quick " + "sort of reverse ordered array: "+computationTime(startTime,endTime)); d[4]=computationTime(startTime,endTime); break; default: System.exit(0); } } j++; } return d; }`

OpenStudy (ajprincess):

without in successive iteration, the loop should exit if the user enters the same input as the input entered in any of the previous iterations.how can i do that?

OpenStudy (ajprincess):

@ganeshie8

OpenStudy (ajprincess):

@e.mccormick

OpenStudy (anonymous):

Store the previously entered value in an array.. and before adding the new name into the array, check the array from the beginning whether the value is already present or not. if present then quit else add it to the array..

OpenStudy (ajprincess):

i tried it but i don't seem to get it

OpenStudy (ajprincess):

this is my full code package miniproject; import java.util.Scanner; public class MiniProject1 { public static void main(String[] args) { Scanner s=new Scanner(System.in); System.out.print("Enter the number of times: "); int x=s.nextInt(); int l=0; while(l<x) { choose(10000); l++; } } public static int[] randomArray(int n) { int ar[]=new int[n]; for (int i = 0; i < ar.length; i++) { ar[i]=(int)(Math.random()*1000); } return ar; } public static void print(int a[]) { for(int b:a) { System.out.print(b+" "); } System.out.println(); } public static int[] reverseArray(int array[]) { for (int i = 0; i < array.length/2; i++) { int temp = array[i]; array[i]=array[(array.length-i)-1]; array[(array.length-i)-1]=temp; } return array; } public static int[] selectionSort(int a[]) { for (int i = 0; i < a.length; i++) { int index_of_min=i; for (int j = i; j < a.length; j++) { if(a[index_of_min]>a[j]) { index_of_min=j; } } int temp=a[i]; a[i]=a[index_of_min]; a[index_of_min]=temp; } return a; } public static void bubbleSort(int a[]) { int i, j, t=0; for (i = 0; i< a.length; i++) { for (j = 1; j< a.length-i; j++) { if(a[j-1]>a[j]) { swap(a, j-1, j); } } } } public static void swap(int a[], int b, int c) { int temp=a[b]; a[b]=a[c]; a[c]=temp; } public static void insertionSort(int array[]) { int i, j, newValue; for (i = 1; i < array.length; i++) { newValue=array[i]; j=i; while (j>0 && array[j-1]>newValue) { array[j]=array[j-1]; j--; } array[j]=newValue; } } public static void mergeSort(int array[],int lo, int hi) { int low=lo; int high=hi; if(low>=high) { return ; } int mid=(low+high)/2; mergeSort(array,low,mid); mergeSort(array,mid+1,high); int end_low=mid; int start_high=mid+1; while((lo<=end_low)&&(start_high<=high)) { if(array[low]<array[start_high]) { low++; } else { int temp=array[start_high]; for (int i = start_high-1; i >=low; i--) { array[i+1]=array[i]; } array[low]=temp; low++; end_low++; start_high++; } } } public static void quickSort(int array[],int left, int right) { int leftPointer = left - 1; int rightPointer = right; if (right - left <= 0) { return; } int pivot = array[rightPointer]; while (true) { while (array[++leftPointer] < pivot) { ; } while (rightPointer > 0 && array[--rightPointer] > pivot) { ; } if (leftPointer >= rightPointer) { break; } else { int T = array[leftPointer]; array[leftPointer] = array[rightPointer]; array[rightPointer] = T; } } int t = array[leftPointer]; array[leftPointer] = array[right]; array[right] = t; quickSort(array,left, leftPointer - 1); quickSort(array,leftPointer + 1, right); } public static void choose(int n) { Scanner s=new Scanner(System.in); long d[]; int A[]=randomArray(n); int a[]=A.clone(); int A1[]=A.clone(); int A2[]=A.clone(); int A3[]=A.clone(); int A4[]=A.clone(); int B[]=selectionSort(A); int b[]=B.clone(); int B1[]=B.clone(); int B2[]=B.clone(); int B3[]=B.clone(); int B4[]=B.clone(); int C[]=reverseArray(B); int c[]=C.clone(); int C1[]=C.clone(); int C2[]=C.clone(); int C3[]=C.clone(); int C4[]=C.clone(); int j=0; System.out.println("Please enter different choice for data sets and algorithm in each iteration"); char p=0; while(j<3) { System.out.println("Choose one of the following types of data sets"); System.out.print("a.Random array\nb.Sorted array\nc.Reversed array\n"); System.out.print("Enter the data type: "); char dataType=s.next().charAt(0); int i=0; if(dataType==p) { return ; } else { p=dataType; switch(dataType) { case 'a': System.out.print("Random array is: "); print(a); d=selectAlgoType(A,A1,A2,A3,A4); System.out.println("Histogram of random array sorted using different sorting techniques"); histogram(d); break; case 'b': System.out.print("Sorted array is: "); print(b); d=selectAlgoType(B,B1,B2,B3,B4); System.out.println("Histogram of sorted array sorted using different sorting techniques"); histogram(d); break; case 'c': System.out.print("Reversed array is: "); print(c); d=selectAlgoType(C,C1,C2,C3,C4); System.out.println("Histogram of reverse ordered array sorted using different sorting techniques"); histogram(d); break; default: System.exit(0); } } j++; } } public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; while(j<5) { algoType=getAlgoType(); if(algoType==prev) { break; } else { prev=algoType; switch(algoType) { case 1: startTime=getTime(); selectionSort(a); endTime=getTime(); System.out.println("Time taken for selection " + "sort: "+computationTime(startTime,endTime)); d[0]=computationTime(startTime,endTime); break; case 2: startTime=getTime(); bubbleSort(a1); endTime=getTime(); System.out.println("Time taken for bubble " + "sort: "+computationTime(startTime,endTime)); d[1]=computationTime(startTime,endTime); break; case 3: startTime=getTime(); insertionSort(a2); endTime=getTime(); System.out.println("Time taken for insertion " + "sort: "+computationTime(startTime,endTime)); d[2]=computationTime(startTime,endTime); break; case 4: startTime=getTime(); mergeSort(a3,0,a3.length-1); endTime=getTime(); System.out.println("Time taken for merge " + "sort: "+computationTime(startTime,endTime)); d[3]=computationTime(startTime,endTime); break; case 5: startTime=getTime(); quickSort(a4,0,a4.length-1); endTime=getTime(); System.out.println("Time taken for quick " + "sort: "+computationTime(startTime,endTime)); d[4]=computationTime(startTime,endTime); break; default: System.exit(0); } } j++; } return d; } public static int getAlgoType() { Scanner s=new Scanner(System.in); System.out.println("Choose any one of the following sorting algorithms"); System.out.print("1.Selection sort\n2.Bubble sort\n3.Insertion sort\n4.Merge sort\n5.Quick sort\n"); System.out.print("Enter your choice: "); int algoType=s.nextInt(); return algoType; } public static long getTime() { long time=System.currentTimeMillis(); return time; } public static long computationTime(long st,long et) { long elapsedTime=et-st; return elapsedTime; } public static void histogram(long array[]) { String output = "Algorithm\trun time\tHistogram"; for ( int count = 0; count <array.length; count++ ) { if((count+1)<=5) { output += "\n" + (count+1) + "\t\t" + array[ count ] + "\t\t"; } else if((count+1)<=10) { output += "\n" + ((count+1)-5) + "\t\t" + array[ count ] + "\t\t"; } else { output += "\n" + ((count+1)-10) + "\t\t" + array[ count ] + "\t\t"; } for ( int stars = 0; stars < array[ count]; stars++ ) { output += "*"; } } System.out.println(output); } }

ganeshie8 (ganeshie8):

Looks mighty !!b

OpenStudy (ajprincess):

thnx.:) where can i make the change if i want to do it as @gsriram7 said. i am so lost

ganeshie8 (ganeshie8):

something like below :- ``` int t=0; int prev[] = new int[10]; int algoType; algoType=getAlgoType(); for(i=0; i<=9; i++) { if(algoType==prev[i]) { exit; } } prev[t++]=algoType; #do watever u want here ```

OpenStudy (ajprincess):

doesn't work

ganeshie8 (ganeshie8):

working : https://ideone.com/GaG4Uj

OpenStudy (ajprincess):

but when I do for mine it is not working.:(

ganeshie8 (ganeshie8):

a bit neat code :- https://ideone.com/F7YehJ just have a quick look :)

ganeshie8 (ganeshie8):

Look at stdin, and stdout stdin : 1 2 5 6 3 3 4 5

ganeshie8 (ganeshie8):

first four values are different, so it simply appends them to the prev[] array

ganeshie8 (ganeshie8):

next, we have two 3's, so it exits...

ganeshie8 (ganeshie8):

stdout : New option, Appending... New option, Appending... New option, Appending... New option, Appending... New option, Appending... Same as previous, Exiting !

OpenStudy (ajprincess):

ya.:)

ganeshie8 (ganeshie8):

https://ideone.com/iMymUE

ganeshie8 (ganeshie8):

here ive changed stdin : 1 2 3 4 5 2 3 4 5 6th input is same as 2nd input , so it exits during 6th iteration

ganeshie8 (ganeshie8):

show me ur specific code, maybe.. ur actual code for entire project is pretty huge... i tried to skim thru it and got lost lol

OpenStudy (ajprincess):

public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; int t=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; int pre[]=new int[10]; while(j<5) { algoType=getAlgoType(); // for (int i = 0; i <=9; i++) { // prev=algoType; // pre[i]=prev; if(algoType==pre[i]) { break; } } switch(algoType) { case 1: startTime=getTime(); selectionSort(a); endTime=getTime(); System.out.println("Time taken for selection " + "sort: "+computationTime(startTime,endTime)); d[0]=computationTime(startTime,endTime); break; case 2: startTime=getTime(); bubbleSort(a1); endTime=getTime(); System.out.println("Time taken for bubble " + "sort: "+computationTime(startTime,endTime)); d[1]=computationTime(startTime,endTime); break; case 3: startTime=getTime(); insertionSort(a2); endTime=getTime(); System.out.println("Time taken for insertion " + "sort: "+computationTime(startTime,endTime)); d[2]=computationTime(startTime,endTime); break; case 4: startTime=getTime(); mergeSort(a3,0,a3.length-1); endTime=getTime(); System.out.println("Time taken for merge " + "sort: "+computationTime(startTime,endTime)); d[3]=computationTime(startTime,endTime); break; case 5: startTime=getTime(); quickSort(a4,0,a4.length-1); endTime=getTime(); System.out.println("Time taken for quick " + "sort: "+computationTime(startTime,endTime)); d[4]=computationTime(startTime,endTime); break; default: System.exit(0); } pre[t++]=algoType; j++; } return d; }

OpenStudy (ajprincess):

u have used true as condition but i have used a j<5 bcos there can't b any statement after while(true) loop isn't t

ganeshie8 (ganeshie8):

here is ur modified code : ``` public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; int t=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; int pre[]=new int[10]; while(j<5) { algoType=getAlgoType(); for(int i=0; i<=9; i++) { if(algoType==pre[i]) { System.out.println("Same as previous, Exiting ! "); return; } } pre[t++]=algoType; switch(algoType) { case 1: startTime=getTime(); selectionSort(a); endTime=getTime(); System.out.println("Time taken for selection " + "sort: "+computationTime(startTime,endTime)); d[0]=computationTime(startTime,endTime); break; case 2: startTime=getTime(); bubbleSort(a1); endTime=getTime(); System.out.println("Time taken for bubble " + "sort: "+computationTime(startTime,endTime)); d[1]=computationTime(startTime,endTime); break; case 3: startTime=getTime(); insertionSort(a2); endTime=getTime(); System.out.println("Time taken for insertion " + "sort: "+computationTime(startTime,endTime)); d[2]=computationTime(startTime,endTime); break; case 4: startTime=getTime(); mergeSort(a3,0,a3.length-1); endTime=getTime(); System.out.println("Time taken for merge " + "sort: "+computationTime(startTime,endTime)); d[3]=computationTime(startTime,endTime); break; case 5: startTime=getTime(); quickSort(a4,0,a4.length-1); endTime=getTime(); System.out.println("Time taken for quick " + "sort: "+computationTime(startTime,endTime)); d[4]=computationTime(startTime,endTime); break; default: System.exit(0); } j++; } return d; } ```

ganeshie8 (ganeshie8):

try it :)

OpenStudy (ajprincess):

this is the output I am getting

OpenStudy (ajprincess):

Enter the number of times: 1 Please enter different choice for data sets and algorithm in each iteration Choose one of the following types of data sets a.Random array b.Sorted array c.Reversed array Enter the data type: a Random array is: 899 512 221 669 77 626 150 956 408 870 250 16 183 992 309 992 706 437 53 20 668 130 846 951 694 556 274 280 268 619 505 598 892 3 668 461 714 32 188 750 75 283 980 255 380 557 603 439 454 148 37 75 67 745 501 735 647 703 845 899 268 883 387 798 896 729 712 978 523 745 884 965 265 113 702 333 703 720 152 963 782 497 935 244 315 587 26 529 755 542 537 162 197 421 775 40 733 421 259 744 172 395 658 941 825 433 55 950 533 484 664 53 367 856 168 392 445 317 125 71 150 426 483 370 610 685 83 825 675 62 205 307 801 460 593 108 171 732 139 496 107 929 361 150 342 564 100 378 983 793 381 55 65 612 252 769 464 337 479 746 512 871 402 745 130 527 925 270 421 453 534 117 676 38 530 493 487 29 123 686 177 461 870 530 97 933 7 734 409 201 570 459 876 536 869 416 807 810 789 139 776 797 583 25 925 776 331 208 677 92 995 297 477 996 32 564 712 720 898 207 329 467 332 899 809 704 249 956 12 919 208 114 159 771 906 68 633 421 853 660 578 637 427 816 259 195 787 146 6 977 713 391 131 146 293 757 589 712 528 533 311 872 341 314 91 482 183 537 595 143 416 42 595 451 919 849 802 115 905 347 714 803 779 683 785 773 958 191 796 574 993 348 757 365 974 864 835 687 174 231 779 832 132 223 66 335 847 628 520 471 623 726 468 63 108 864 614 362 494 805 637 216 445 383 241 290 262 421 769 592 997 773 748 176 707 843 710 462 802 889 435 270 513 985 306 314 802 538 835 609 661 859 517 964 659 407 99 495 724 960 29 897 647 172 321 993 497 653 322 991 173 993 908 709 603 881 429 976 696 822 348 349 989 747 858 274 99 220 961 809 486 807 387 97 775 635 488 809 817 117 719 926 987 308 613 314 739 378 214 754 261 280 776 256 213 712 173 723 877 162 854 303 773 918 387 27 711 632 577 686 491 251 938 224 996 830 769 330 209 58 468 314 755 116 756 799 950 817 384 241 967 858 555 807 653 414 727 663 738 211 671 302 662 720 682 158 13 64 613 365 611 777 941 203 618 612 479 447 633 164 397 596 668 221 195 680 30 362 897 167 616 557 265 280 846 182 16 926 496 145 130 281 967 572 81 21 124 812 477 122 687 367 922 132 310 702 107 823 888 808 58 185 359 811 190 767 239 884 310 514 392 217 30 336 94 816 46 849 281 466 670 904 967 267 542 752 224 795 935 947 781 59 179 396 255 129 773 264 271 504 442 802 217 57 976 573 221 632 961 915 978 216 646 984 430 904 38 155 947 781 981 90 580 213 417 312 146 996 253 702 412 250 239 928 395 953 63 466 859 543 427 523 388 34 212 868 72 738 958 319 689 735 811 382 466 945 756 321 947 795 449 777 227 201 174 896 849 831 539 808 918 381 279 222 614 912 175 832 107 117 437 240 42 775 105 66 170 537 888 988 423 611 669 522 686 903 314 437 831 625 792 854 75 448 599 229 590 798 386 626 396 995 273 914 941 562 761 757 468 160 346 601 214 303 880 142 713 214 515 122 14 910 570 712 390 920 968 104 229 789 33 429 130 908 243 573 881 53 250 966 926 408 888 973 109 813 121 89 998 398 871 718 827 774 462 986 181 502 980 672 827 562 174 50 758 186 678 173 372 498 211 862 888 77 133 484 570 731 170 394 46 470 404 800 43 945 626 666 134 341 999 195 705 72 533 386 172 428 282 125 658 697 312 293 726 202 442 382 504 106 456 244 489 793 17 614 613 168 764 270 676 179 168 795 115 483 537 121 132 219 204 285 671 495 348 45 327 336 55 333 293 514 227 813 639 919 687 182 756 828 351 237 593 761 668 128 385 358 606 687 952 101 361 184 251 538 595 368 840 79 471 214 64 368 962 339 293 684 912 668 297 830 114 565 894 494 225 305 322 101 696 464 425 794 6 519 602 270 410 734 669 870 84 163 215 484 39 456 788 556 408 986 249 721 757 708 936 351 873 67 859 642 86 231 11 663 552 885 8 187 88 862 713 9 67 879 188 889 648 768 310 229 52 657 654 69 938 713 786 31 957 207 955 374 418 877 261 437 643 761 790 335 960 977 862 944 505 167 496 892 957 685 448 463 82 926 669 88 501 613 844 366 397 242 743 349 990 351 500 185 473 745 525 63 750 329 740 804 779 737 995 393 527 497 997 185 544 117 902 513 949 70 705 976 194 336 934 706 293 866 760 528 360 39 499 25 173 965 698 178 200 251 410 448 978 703 18 831 983 245 0 728 173 264 285 179 189 474 461 369 802 355 956 114 567 188 428 427 791 735 56 152 892 622 108 79 900 595 140 939 396 878 485 139 432 38 183 146 74 884 382 978 17 172 321 333 369 60 412 534 113 569 597 586 927 562 123 344 24 81 119 996 421 245 841 802 574 285 301 310 647 711 26 84 751 52 85 294 383 84 155 414 950 988 310 648 708 378 433 644 633 768 641 535 790 597 853 302 521 595 714 23 324 938 397 581 673 306 404 36 129 737 418 945 17 871 383 599 604 23 479 291 226 291 379 471 23 817 189 871 994 142 785 461 896 558 819 401 93 285 543 5 861 274 737 62 782 474 448 823 829 389 944 320 437 889 298 708 371 284 244 772 488 829 537 783 539 3 840 448 10 76 307 769 630 722 385 259 574 693 71 106 585 860 775 550 199 238 210 974 17 976 220 921 501 675 265 540 71 809 376 786 393 462 719 990 610 104 580 343 932 583 498 175 437 107 459 901 156 527 584 919 520 838 467 761 13 464 412 329 463 542 115 81 728 123 952 644 670 937 950 429 209 126 645 475 950 138 547 958 332 790 594 461 512 388 69 395 213 629 682 701 597 973 163 287 805 88 513 490 191 955 243 196 423 245 346 203 573 591 426 779 43 482 432 378 644 577 680 954 476 397 409 319 274 500 948 587 758 447 666 787 142 106 292 387 361 69 840 592 775 287 348 965 63 309 860 157 780 903 613 229 589 183 176 368 474 816 362 577 356 295 120 269 397 776 223 559 932 456 521 438 424 28 701 970 40 311 14 83 448 767 174 543 231 227 682 204 863 839 169 707 543 944 956 362 310 285 920 83 767 753 924 888 424 639 533 663 161 185 465 588 534 88 252 879 701 487 862 271 553 881 647 973 225 373 809 653 534 614 735 397 75 816 975 470 599 273 330 148 66 867 521 845 226 157 153 255 891 783 254 251 113 69 495 849 316 934 299 611 94 394 451 507 743 275 478 374 824 954 37 819 12 362 782 612 213 755 689 352 521 186 616 475 822 25 973 478 23 303 709 556 705 144 494 737 687 52 863 985 413 376 333 678 290 823 948 325 133 507 515 386 609 660 798 579 184 779 309 114 387 690 918 879 347 749 392 728 461 128 177 667 748 954 157 901 891 876 873 448 263 495 713 240 202 956 854 412 683 950 348 805 77 287 582 512 86 203 492 695 103 557 327 792 166 115 481 644 419 206 872 61 473 120 634 832 355 750 416 191 793 165 445 335 422 975 563 646 142 591 918 921 239 736 573 26 94 853 334 115 255 380 275 711 416 209 978 749 357 37 311 912 237 734 621 411 710 278 612 706 213 321 785 512 438 917 273 858 427 524 79 881 975 930 234 501 978 376 139 117 205 770 425 2 494 568 962 103 722 568 296 563 48 618 660 397 812 980 875 382 170 892 935 435 13 680 778 440 972 635 786 731 340 756 827 233 562 360 263 529 524 516 183 10 261 249 273 581 870 443 159 333 314 429 750 8 578 324 120 33 87 258 701 429 615 795 133 873 962 0 933 798 506 799 268 477 413 518 481 640 621 733 731 366 975 864 31 632 816 261 211 131 81 886 868 717 531 69 125 95 998 252 143 197 676 53 659 6 324 495 478 481 923 702 768 589 775 976 211 456 227 666 546 20 231 889 808 648 706 789 622 639 269 675 224 625 195 78 503 466 648 501 258 333 90 390 9 346 476 649 181 307 331 825 219 770 25 976 165 945 612 83 594 710 424 799 316 290 168 290 169 25 696 849 328 7 742 48 997 247 867 163 59 504 582 712 231 826 112 58 547 379 545 137 532 145 172 545 270 639 686 426 678 870 504 824 666 391 910 399 576 453 893 746 215 922 530 817 45 858 497 355 609 392 854 592 67 812 542 896 797 553 117 501 384 174 156 921 937 203 383 157 631 208 43 371 548 306 243 228 389 850 985 757 391 980 423 177 837 273 390 825 865 782 643 8 904 319 355 329 954 992 318 793 83 617 981 803 9 832 964 958 314 449 883 437 905 808 393 608 607 689 158 464 350 632 49 374 301 366 245 669 388 390 86 552 131 684 429 897 374 923 33 524 499 558 939 706 973 598 142 727 633 976 885 529 936 909 768 664 510 770 481 973 732 610 379 720 745 592 306 146 272 313 48 777 809 179 545 132 311 745 514 892 284 215 462 992 264 101 167 534 24 356 550 929 512 200 561 139 410 233 105 481 456 357 281 980 97 512 179 889 871 198 292 622 911 308 146 1 329 823 90 438 821 533 345 356 749 42 269 975 120 993 532 315 327 598 342 140 260 295 101 379 421 586 932 484 961 882 312 60 135 499 645 78 545 768 984 949 671 606 268 735 619 785 388 844 713 579 98 582 548 403 304 83 389 592 533 240 347 453 468 443 587 306 245 112 938 305 880 255 675 445 552 532 895 327 701 592 888 906 833 783 116 690 705 676 944 582 73 235 69 828 510 875 648 358 899 105 522 131 66 918 538 954 698 603 923 678 113 212 850 562 665 450 833 83 594 388 338 476 877 38 77 763 234 449 733 149 752 736 526 200 763 155 882 363 467 75 660 20 511 533 845 471 212 845 334 931 329 612 488 879 355 338 393 871 90 801 360 235 874 249 68 903 205 499 881 994 656 980 286 686 913 853 138 310 507 370 328 593 285 764 817 454 969 81 479 781 196 533 50 182 301 159 588 782 706 779 226 759 204 527 698 450 600 497 44 576 161 394 156 291 47 397 339 550 470 862 852 540 594 888 477 743 323 207 524 509 982 359 338 911 539 610 252 51 502 605 194 895 781 329 588 198 857 555 995 75 368 570 957 277 757 668 864 308 29 561 249 94 726 621 827 46 188 584 758 981 829 184 68 586 631 964 891 784 312 392 243 626 664 278 281 105 354 409 638 583 91 274 245 368 425 701 206 355 620 274 724 515 956 407 762 480 552 40 124 414 308 25 891 862 827 381 722 281 252 807 325 534 806 984 539 691 435 476 851 122 360 246 843 993 558 158 19 975 123 83 698 190 239 646 187 130 20 993 209 610 778 384 699 573 391 872 380 928 298 795 216 477 329 322 746 351 992 832 497 357 78 478 185 44 441 886 155 342 578 588 569 108 228 420 185 999 513 863 172 669 317 971 292 396 457 347 987 908 931 383 299 358 971 803 366 89 888 421 181 103 737 885 644 903 624 117 507 683 90 82 653 694 376 509 320 953 531 205 288 394 251 620 743 975 90 408 544 207 142 834 851 82 610 999 663 395 726 28 585 10 322 557 327 699 12 97 752 820 296 86 36 231 159 755 391 527 622 237 94 896 543 725 39 641 414 826 854 666 286 724 688 64 989 174 144 261 732 840 466 21 812 4 22 71 581 202 318 972 71 918 273 367 662 74 239 712 950 688 318 130 563 725 831 70 982 880 431 58 593 741 223 926 53 561 434 573 795 628 640 474 918 83 273 886 993 846 159 922 329 221 144 449 75 666 425 79 103 140 73 343 13 446 383 510 759 964 104 436 315 242 290 208 541 952 528 369 900 857 552 966 947 522 779 683 613 721 177 910 96 635 940 657 851 217 867 850 542 295 999 685 22 351 36 430 377 161 270 229 814 880 306 239 719 536 644 700 498 278 240 334 944 224 575 807 724 177 363 873 237 23 961 197 553 156 763 790 336 838 331 467 681 8 781 706 551 697 4 837 88 861 609 519 405 142 118 77 577 792 798 366 502 773 706 491 929 798 992 893 472 939 204 20 654 263 394 32 68 826 84 798 541 304 774 711 801 456 490 704 508 607 40 216 676 344 63 751 445 655 656 114 889 820 346 355 41 457 456 955 594 265 441 820 819 168 620 178 65 769 822 595 838 229 866 919 875 972 470 116 797 896 127 659 916 71 734 311 505 303 262 916 378 273 578 78 951 424 572 397 22 177 136 298 431 564 171 327 350 848 713 210 471 269 486 884 513 591 668 199 505 773 425 931 73 668 816 339 537 366 999 491 936 467 278 221 265 304 433 653 85 888 925 921 375 159 50 853 943 922 832 142 994 712 463 719 460 714 407 871 513 789 859 919 295 578 95 101 256 660 420 716 656 742 822 438 723 878 146 154 681 823 596 671 369 693 637 75 431 268 909 604 155 412 605 413 855 298 868 724 327 349 158 447 325 71 205 530 166 220 136 962 585 102 572 572 660 133 38 503 210 170 797 530 338 550 326 169 927 225 993 898 731 827 137 637 399 53 694 80 183 249 689 352 307 696 421 976 983 652 923 84 836 881 337 366 48 34 154 284 921 966 909 667 620 777 777 940 832 157 728 865 706 359 310 864 958 998 907 709 233 679 303 606 888 380 701 460 138 389 908 443 131 594 281 786 868 843 139 124 72 157 805 592 10 561 110 314 27 435 204 884 31 318 778 940 465 302 335 947 338 253 997 860 778 350 431 436 142 616 886 568 172 397 976 176 845 39 830 861 541 302 450 745 921 456 627 665 408 332 581 155 512 52 566 465 300 600 16 198 223 867 494 19 136 312 586 274 818 940 122 316 483 836 557 764 812 122 141 945 784 844 540 267 170 921 901 343 893 36 963 272 577 36 717 590 523 189 273 70 29 431 66 709 457 547 259 983 684 99 213 653 610 794 192 223 223 879 71 422 296 131 645 942 178 966 298 9 301 189 203 301 954 989 946 103 601 798 426 612 522 785 175 749 829 863 765 881 995 249 833 414 837 845 314 302 576 886 928 125 949 609 571 545 580 952 278 652 755 634 614 871 522 303 882 906 545 845 355 421 482 335 779 997 723 577 782 224 223 651 460 652 810 403 338 752 786 318 83 922 874 858 871 86 532 857 52 384 489 293 790 6 855 340 738 263 572 368 350 573 39 223 374 177 690 943 229 22 980 791 407 449 692 365 798 33 753 351 851 157 758 406 749 686 228 543 421 396 214 359 991 684 237 408 483 408 717 42 973 644 980 79 101 554 641 717 848 533 677 241 731 291 784 175 134 556 659 719 324 620 724 493 778 77 393 841 898 674 437 217 795 373 150 443 844 407 12 976 885 297 293 651 516 567 566 772 684 164 412 814 875 381 713 467 568 428 768 223 240 675 172 205 166 964 782 494 416 342 372 777 989 21 528 729 741 357 148 191 844 168 467 864 838 788 870 940 929 789 879 805 104 489 617 730 787 954 731 239 223 416 230 664 513 731 943 261 235 752 342 142 885 244 275 176 955 301 750 985 323 56 318 122 765 816 698 523 838 696 299 385 70 226 947 664 385 376 680 529 961 940 712 191 270 240 770 739 853 672 817 792 536 693 827 981 145 482 671 584 471 638 367 878 191 972 910 121 668 673 661 424 104 823 795 152 274 587 628 910 187 127 729 625 358 697 617 695 23 192 476 701 551 856 781 710 516 771 937 770 365 204 29 803 404 905 583 728 850 955 773 324 44 812 884 23 516 818 940 568 498 524 338 216 650 841 984 959 199 218 950 68 469 758 851 100 744 409 249 405 750 160 138 78 592 476 205 257 852 35 912 631 701 191 622 41 290 523 902 91 395 202 885 775 279 929 57 190 992 656 126 589 891 319 675 145 975 413 183 32 754 265 579 628 753 531 934 926 437 560 74 509 279 967 860 780 945 957 642 494 80 691 930 3 973 263 608 55 469 649 167 443 839 345 244 250 983 265 474 977 243 867 41 346 323 430 588 182 280 823 110 343 345 160 244 324 349 188 950 809 875 378 901 175 880 241 36 620 385 494 637 416 41 400 974 517 822 738 45 620 815 599 169 589 119 435 240 77 140 565 254 60 174 657 318 963 992 525 731 31 333 954 868 606 585 185 563 18 666 88 381 849 103 36 681 460 558 988 662 777 609 298 629 531 421 338 579 293 55 89 823 927 542 512 763 312 547 605 148 468 366 786 87 573 275 411 853 676 737 20 46 320 772 131 991 689 901 258 360 354 402 120 847 144 279 921 422 219 257 928 102 912 326 561 412 520 848 626 690 809 982 337 205 623 271 304 580 669 521 680 397 246 746 318 949 391 826 821 51 701 697 92 468 867 372 132 23 775 775 544 684 890 457 474 953 517 490 458 713 443 465 981 270 432 361 363 706 985 190 985 816 833 747 735 839 619 521 16 927 354 759 593 767 270 6 70 83 890 925 800 793 250 91 587 450 443 514 639 202 842 68 827 943 661 673 480 495 775 8 597 630 41 801 605 502 734 231 499 593 76 801 501 572 262 83 165 584 832 143 199 342 703 58 148 74 719 874 464 786 54 563 435 554 459 9 912 533 857 839 741 168 498 939 360 656 510 844 59 35 375 790 990 430 630 118 139 866 792 875 122 764 341 930 831 704 404 655 690 277 616 221 508 901 561 877 708 263 55 153 983 677 532 783 318 989 733 283 630 846 938 567 220 68 982 645 643 579 421 478 556 878 251 291 626 278 789 234 565 238 414 61 953 928 143 661 572 826 159 621 594 512 748 704 136 58 332 60 345 341 637 240 412 393 377 578 653 399 221 334 49 303 231 39 480 47 389 861 189 364 326 449 896 687 868 644 392 199 552 618 344 228 837 534 538 247 337 554 760 459 52 69 32 573 199 381 7 668 992 645 878 203 411 796 295 121 765 344 437 695 661 373 541 221 793 838 938 924 823 228 856 474 523 19 49 311 233 849 598 594 670 282 87 949 82 111 693 341 739 600 679 370 828 773 148 954 845 818 934 918 728 982 963 262 63 821 451 938 894 577 877 836 842 479 725 279 485 226 639 759 197 543 767 807 924 674 747 885 729 891 13 923 259 652 843 665 683 786 818 293 63 217 213 901 580 59 128 269 481 570 77 19 162 382 124 727 318 623 606 709 656 22 918 285 299 873 873 31 612 767 612 137 861 341 164 337 816 896 284 958 125 628 348 604 45 394 728 623 927 379 242 21 643 786 997 696 16 662 172 938 195 278 85 919 822 86 162 517 796 91 299 177 412 658 443 684 660 171 145 650 511 685 236 234 87 671 793 139 721 254 977 176 31 863 437 779 319 60 450 683 779 407 115 612 251 645 502 223 488 113 810 748 221 298 294 741 601 632 893 87 984 189 268 971 366 712 223 808 233 486 274 235 997 946 486 132 708 520 563 328 199 168 564 38 400 259 562 334 87 903 20 947 988 654 644 462 733 530 11 561 879 605 322 271 858 83 193 358 488 618 568 855 414 828 428 446 628 419 188 865 71 43 379 758 144 62 449 434 846 655 288 808 178 320 407 377 397 643 513 483 674 392 610 258 723 370 642 591 20 212 137 164 274 253 253 136 949 895 151 286 737 429 617 550 77 103 411 667 984 336 942 345 705 374 434 694 952 352 946 919 776 682 255 202 452 920 842 471 98 787 964 270 155 811 44 274 225 140 471 74 274 433 163 748 619 386 191 374 679 353 109 85 977 755 580 506 463 432 367 373 843 864 723 959 201 248 760 463 897 728 419 887 416 700 267 33 536 4 437 166 3 969 714 590 632 766 907 828 607 230 405 370 603 330 16 979 222 795 999 354 164 930 467 545 502 578 219 897 390 268 384 449 555 53 192 661 978 230 604 54 198 111 491 849 826 303 555 986 953 479 204 949 315 473 150 676 276 613 583 471 919 645 398 214 771 213 98 387 27 869 669 373 395 789 959 259 97 901 803 894 909 922 431 269 533 892 512 384 84 136 489 632 898 241 759 416 406 550 650 101 364 886 49 691 282 698 39 553 503 582 849 351 24 203 4 870 816 937 545 792 80 196 850 583 624 262 650 577 297 653 507 17 194 489 204 296 198 45 198 887 236 728 539 467 547 982 425 593 152 219 875 832 680 739 838 669 654 726 418 642 386 844 804 110 641 665 914 775 313 122 740 562 461 486 845 794 178 866 531 582 939 107 707 285 267 38 599 449 786 426 70 74 983 669 432 254 294 204 351 173 459 855 645 227 421 848 494 549 465 25 900 534 657 882 5 69 141 375 224 19 298 142 24 215 283 641 570 601 9 977 386 416 209 615 671 318 800 994 848 95 443 66 510 216 796 133 938 781 730 973 968 581 432 101 112 882 132 236 469 218 952 455 155 972 206 270 689 759 332 878 21 668 523 143 643 217 25 410 564 486 39 172 722 268 131 690 830 224 46 132 485 971 898 488 871 763 742 491 287 907 662 62 264 354 641 331 47 961 613 118 768 758 354 865 730 210 20 419 837 819 475 706 358 655 783 327 893 336 588 312 610 748 457 806 585 317 641 245 338 963 109 671 456 971 198 174 561 861 645 131 710 35 320 775 746 384 495 899 30 276 71 929 454 345 765 401 629 274 922 902 662 342 256 889 987 836 536 386 327 566 960 466 942 625 700 588 7 219 927 330 112 868 405 761 614 530 626 763 801 227 330 846 598 574 170 652 864 192 227 129 153 383 57 571 195 582 971 74 233 56 275 722 802 17 270 753 477 856 932 261 642 438 295 512 320 505 762 790 673 48 728 802 897 155 155 61 797 243 988 330 530 755 581 178 657 408 640 933 865 789 539 812 459 657 227 845 998 610 408 242 272 872 49 262 122 835 836 237 499 639 626 365 548 530 536 71 444 925 863 214 134 155 624 212 194 597 156 168 461 497 873 451 228 130 958 748 312 48 527 539 470 100 542 98 271 577 526 575 702 314 989 458 515 840 299 725 557 666 624 303 102 671 488 14 506 76 433 64 342 922 239 264 553 106 197 593 40 962 928 435 557 100 350 772 708 729 469 922 398 943 824 934 35 543 567 580 408 795 368 13 202 154 549 527 762 390 117 561 843 752 661 993 782 748 391 69 732 910 944 765 334 403 996 230 501 683 81 3 759 490 527 70 961 332 839 472 35 290 415 95 840 400 983 463 117 83 744 873 15 116 798 944 626 398 66 710 528 335 585 738 350 22 744 321 990 507 777 734 237 353 554 669 153 380 536 453 826 951 562 376 738 421 978 467 302 382 539 364 837 172 386 491 622 702 385 638 434 15 57 151 404 186 363 379 891 67 649 743 511 138 98 739 436 189 170 493 535 890 637 16 998 307 969 120 609 329 45 113 926 545 380 725 254 557 307 437 437 876 880 307 182 530 527 652 835 269 901 422 270 766 695 949 838 551 667 784 121 483 505 735 560 466 693 837 927 755 3 911 978 641 819 588 563 533 37 139 953 438 907 229 99 638 801 768 101 920 586 340 187 61 936 325 110 392 672 704 997 181 981 722 289 251 132 21 658 734 148 611 438 104 739 54 386 648 687 522 351 397 780 997 741 71 353 714 503 8 459 98 713 211 711 888 763 534 863 811 567 821 294 177 172 246 625 36 643 429 871 67 130 940 667 211 563 667 319 173 533 139 646 299 508 292 857 11 694 391 977 953 544 741 655 192 106 615 580 403 159 332 49 690 368 737 710 836 463 447 898 97 834 71 509 314 743 298 806 27 811 178 160 510 318 121 232 71 362 177 765 806 872 903 736 973 37 721 332 524 725 985 863 933 100 124 498 336 716 131 426 196 58 342 870 136 649 932 181 338 573 810 100 908 497 614 158 913 61 325 95 374 792 623 144 359 554 471 969 456 904 574 85 343 627 303 629 850 146 401 386 936 481 252 123 220 902 834 392 290 472 489 121 831 204 517 538 719 666 214 167 627 470 392 919 356 240 590 575 60 330 180 291 779 780 295 99 186 733 63 762 284 815 924 764 836 789 918 660 702 128 699 469 873 14 688 347 927 682 221 258 840 944 757 983 562 211 233 384 526 292 407 475 346 810 617 533 226 100 718 145 271 68 89 861 750 571 502 840 543 582 340 690 452 523 125 514 811 907 558 29 815 660 305 518 313 254 590 265 381 104 239 108 844 521 191 677 64 863 667 933 733 448 102 640 121 200 696 484 197 986 905 649 325 76 505 792 776 183 911 548 127 118 272 844 729 151 520 587 826 800 906 496 558 943 801 182 58 775 461 871 81 400 249 525 112 560 298 515 704 276 950 395 881 3 367 783 797 219 622 826 469 233 192 249 356 426 261 498 738 27 414 108 329 26 353 970 349 792 988 851 302 512 890 163 56 597 375 692 420 804 649 687 305 953 344 528 735 727 463 917 422 277 211 413 364 10 461 938 918 236 622 811 140 82 485 733 704 405 235 133 647 270 176 249 243 939 884 303 814 183 436 222 931 200 84 366 468 365 248 882 243 516 970 392 512 539 68 924 421 539 16 166 636 990 274 367 745 868 135 444 721 916 383 190 671 891 12 744 346 814 12 867 379 44 752 965 62 212 811 172 494 907 208 301 336 312 833 906 42 855 580 236 329 374 71 397 910 178 130 592 923 886 125 929 347 892 110 921 646 856 233 452 298 648 258 704 416 778 130 226 593 461 458 148 258 102 462 259 295 185 397 559 407 258 726 687 724 923 343 561 453 568 960 450 951 822 367 648 446 600 651 919 801 944 620 848 109 782 596 336 637 145 511 474 588 350 668 201 476 162 881 238 373 937 731 983 209 351 521 225 327 372 166 791 969 755 630 472 965 514 728 874 925 463 73 173 400 176 714 83 48 427 513 748 615 454 661 678 617 204 789 289 975 44 44 102 517 295 122 137 128 346 708 609 610 32 4 584 721 428 985 860 701 199 863 971 576 169 745 889 907 837 859 670 247 142 831 47 442 911 394 709 117 57 618 809 120 795 206 50 433 832 655 580 96 756 121 766 955 601 621 876 651 883 829 622 125 236 65 493 31 149 269 823 908 190 654 576 641 556 482 913 724 732 897 677 134 539 17 106 128 888 577 219 157 86 247 529 144 660 353 966 819 258 193 142 429 335 259 392 141 50 699 338 649 944 79 76 40 787 49 478 760 201 809 501 617 494 400 861 76 483 687 884 806 933 588 883 300 659 510 918 641 248 200 398 929 844 213 559 703 408 966 517 679 400 931 223 513 897 856 372 858 727 20 42 916 326 456 576 833 688 747 41 741 927 474 397 11 719 646 370 261 107 486 903 987 939 734 980 259 513 254 564 773 837 84 351 712 290 230 83 266 344 463 169 396 481 69 455 373 354 13 81 939 759 281 499 435 24 192 886 105 926 342 381 882 404 463 819 351 880 877 868 265 220 432 787 938 986 756 333 79 883 427 697 134 41 203 745 36 21 725 241 285 280 267 169 703 128 913 788 804 109 252 507 660 120 96 246 353 509 945 512 584 882 931 19 754 300 759 299 937 114 706 459 416 711 119 879 144 45 935 423 314 945 697 462 442 833 196 815 803 678 350 527 792 712 189 255 805 685 841 927 535 209 218 241 149 38 715 522 681 992 594 440 107 562 899 90 6 173 661 979 400 491 905 538 360 117 436 878 225 523 704 647 846 95 66 993 67 705 644 868 790 329 593 96 357 842 986 916 644 255 736 986 235 379 926 167 252 64 672 740 973 940 191 119 122 849 33 504 832 961 557 408 626 907 593 426 394 126 885 146 287 32 369 645 646 524 530 572 550 844 110 429 369 741 211 287 721 493 389 865 592 309 702 552 959 289 782 724 169 216 922 435 498 73 844 375 747 419 297 780 503 410 872 878 674 537 470 270 224 905 654 645 622 184 719 85 347 220 701 281 966 623 674 904 717 600 665 499 201 680 187 262 838 976 933 231 933 116 444 507 803 968 600 312 228 902 679 873 571 345 311 369 363 72 75 405 754 766 690 798 246 113 703 764 313 863 322 950 58 74 609 144 841 988 514 906 895 838 373 812 318 181 317 478 441 247 762 37 529 188 514 303 964 26 309 387 522 589 563 173 168 688 918 676 795 341 709 963 688 872 851 40 107 334 739 800 251 800 686 917 71 733 103 347 812 794 91 915 953 215 375 330 175 44 529 842 322 389 276 686 899 76 216 383 469 971 730 965 524 595 956 192 754 543 677 860 394 668 676 395 294 945 616 998 617 411 782 766 642 630 99 370 948 649 661 64 385 540 653 26 632 213 949 306 797 325 848 918 484 844 396 964 983 962 481 14 751 869 426 344 155 110 110 72 531 109 757 656 957 739 398 695 798 699 658 522 1 878 998 542 301 772 699 931 23 531 948 835 887 182 98 891 314 77 800 538 24 732 0 284 347 732 953 827 565 571 295 679 748 879 915 743 36 723 822 103 28 339 474 149 974 927 50 30 739 893 978 370 124 236 593 84 953 626 228 156 500 59 145 219 240 910 680 824 621 600 698 369 538 89 939 733 440 870 126 835 587 184 777 456 757 725 491 903 841 185 127 282 161 618 667 445 994 746 794 923 761 3 125 521 564 349 847 567 274 588 989 220 171 254 915 637 222 873 692 252 424 802 864 903 304 671 849 43 583 883 569 815 200 542 183 343 405 642 769 191 367 351 600 584 825 739 205 631 593 367 770 514 395 719 539 303 352 612 807 847 633 323 758 958 253 399 893 931 695 796 39 316 100 242 944 699 25 515 310 210 366 589 674 398 908 495 960 88 100 59 642 856 64 604 438 789 574 144 139 279 712 532 703 688 176 538 12 855 757 852 755 616 361 560 763 639 6 728 708 168 682 354 536 497 581 86 145 276 185 798 827 105 936 316 713 191 709 332 19 251 135 829 185 241 871 129 95 955 304 23 466 995 780 311 112 148 422 476 260 713 750 143 304 927 849 447 373 215 564 411 894 633 265 984 873 544 60 407 971 251 917 211 586 48 86 221 31 900 346 618 639 769 96 291 21 401 997 407 37 263 940 383 996 190 373 222 479 226 613 456 724 74 645 822 909 566 14 102 849 574 881 522 499 784 990 494 451 889 289 453 54 809 208 50 99 695 161 976 61 656 637 234 754 313 400 802 843 540 665 198 114 991 813 645 551 320 164 208 248 299 559 462 966 413 0 37 616 893 434 612 330 537 805 774 825 159 887 483 674 938 35 732 724 484 932 425 384 957 589 405 670 154 367 27 952 78 541 665 79 146 966 85 160 835 766 630 603 305 536 804 147 200 478 906 526 666 23 62 99 339 996 142 237 929 59 799 526 863 242 81 865 325 616 849 351 951 781 562 443 400 683 779 282 968 418 154 171 450 113 552 193 475 656 367 649 626 67 86 481 740 533 628 173 949 698 12 631 138 634 474 433 755 997 218 447 73 313 639 213 310 958 968 692 287 402 987 952 603 471 692 90 707 950 478 253 578 600 745 918 184 775 605 679 299 168 696 677 769 863 8 465 803 793 991 536 404 901 183 953 657 798 19 545 147 473 502 881 456 648 936 832 324 720 965 853 775 828 775 250 222 475 389 602 330 318 694 210 214 181 968 882 348 85 404 662 440 115 401 91 399 231 101 447 422 704 26 974 205 740 469 502 240 974 647 11 160 949 576 632 160 407 4 311 580 177 720 820 822 753 78 148 940 163 539 306 387 576 658 456 586 226 967 906 264 564 880 891 688 305 840 284 288 901 667 314 432 290 217 160 493 222 264 779 720 303 742 676 851 951 318 392 847 843 606 385 597 43 174 615 958 952 927 595 44 420 356 888 236 810 617 33 985 646 398 648 126 425 46 58 87 609 489 96 54 323 81 889 896 259 601 321 427 401 299 578 324 678 60 616 904 355 461 694 762 27 750 84 189 335 547 946 188 142 371 896 860 744 925 214 904 828 470 774 983 345 471 710 771 124 172 578 509 76 703 248 89 85 795 61 720 237 251 837 483 860 813 169 217 967 224 76 432 94 833 463 210 155 292 71 320 961 549 522 116 212 551 849 138 341 845 422 705 356 483 485 215 931 508 636 320 316 585 426 602 338 228 954 905 624 481 721 1 426 826 274 856 902 568 143 350 453 917 358 944 801 546 417 461 788 429 897 820 505 361 29 328 245 686 495 845 958 402 338 983 311 986 408 260 233 13 966 43 808 868 136 946 686 629 686 307 777 516 225 274 822 114 281 48 612 980 868 804 22 104 104 873 737 162 157 836 551 434 291 275 354 762 77 66 498 960 880 267 52 616 605 847 559 341 280 717 310 124 489 818 829 598 832 264 182 711 578 898 15 517 423 955 690 504 783 901 715 217 387 963 731 672 23 271 692 441 149 36 500 130 764 704 287 392 356 533 750 523 972 646 400 178 446 198 402 708 612 928 673 182 895 40 289 161 8 46 812 933 606 941 88 2 687 825 192 273 162 888 702 584 543 493 159 908 917 944 647 833 410 401 686 654 158 343 212 781 418 895 307 930 787 336 444 990 699 106 468 336 271 666 225 788 315 647 720 371 818 808 996 547 486 484 412 599 1 339 896 393 486 467 790 853 315 79 360 91 785 302 663 272 377 884 458 8 300 939 52 241 744 201 516 363 839 650 475 561 578 790 793 204 105 294 781 408 623 220 262 802 828 515 690 895 225 31 767 399 908 901 461 305 358 682 107 509 639 322 329 320 885 678 814 211 370 990 638 798 525 482 673 116 212 959 824 925 249 119 271 969 617 95 651 803 81 572 94 60 948 760 376 798 515 371 976 887 369 712 738 199 35 0 926 778 676 976 940 24 454 984 612 391 885 695 28 26 41 814 57 304 704 206 339 216 669 55 305 119 222 858 906 475 444 302 122 782 415 307 10 75 550 828 983 64 315 313 258 156 268 83 921 380 946 276 875 500 412 400 981 397 369 23 98 153 636 550 345 126 429 602 845 714 336 20 402 429 71 80 69 365 141 149 296 144 293 598 447 942 186 486 739 254 114 205 328 635 658 21 125 808 135 193 88 114 335 143 236 532 543 973 308 158 86 480 59 301 666 710 440 105 565 975 519 951 413 256 855 678 549 845 146 83 208 106 457 15 674 294 973 834 263 396 249 968 520 112 193 778 273 194 527 978 264 533 368 419 912 590 605 103 402 988 212 959 694 330 239 10 224 628 250 283 67 10 146 1 45 753 873 352 833 75 294 388 403 505 581 445 243 133 861 772 695 489 455 948 354 332 32 71 977 160 128 616 513 808 39 330 901 143 806 523 54 455 100 651 7 837 113 114 557 530 184 806 851 945 801 71 272 826 739 339 684 808 612 934 544 449 809 239 656 669 813 645 357 412 203 488 772 246 214 491 319 596 604 54 70 247 679 108 706 788 810 150 738 697 428 506 407 833 488 822 156 222 671 297 862 137 120 173 73 648 343 567 344 25 41 811 393 562 982 94 189 720 738 321 307 700 48 838 811 934 809 821 720 307 197 909 606 325 252 945 217 828 304 441 93 339 992 794 28 574 284 75 886 174 798 678 719 243 965 985 349 875 14 726 586 406 582 645 28 821 750 666 960 360 657 765 206 96 461 352 917 966 296 109 190 509 45 843 95 347 213 115 159 260 911 119 607 585 987 518 691 507 632 727 260 786 357 425 298 341 134 945 561 152 582 514 579 916 552 264 232 927 147 319 841 753 177 265 199 357 370 776 264 448 150 202 287 35 664 486 994 312 819 859 90 271 518 372 719 680 908 498 739 344 465 681 619 905 917 964 535 791 578 523 747 279 414 262 682 97 282 377 223 394 119 176 582 414 507 277 813 698 957 740 417 197 480 586 761 236 466 635 993 874 684 593 948 849 252 825 69 944 766 331 756 324 366 995 640 114 438 337 208 244 793 611 899 375 650 285 239 560 448 674 853 119 572 683 212 113 336 470 808 704 168 71 998 640 800 900 205 80 399 428 242 989 6 184 527 353 347 711 650 569 78 35 240 426 776 721 400 273 544 589 7 87 937 751 25 393 2 682 636 182 641 691 352 264 169 272 490 742 884 536 372 659 722 86 323 194 564 498 113 169 582 796 781 53 69 145 875 94 572 308 26 688 786 284 423 579 587 957 206 81 790 493 989 10 698 697 762 681 278 540 171 922 851 585 762 736 507 84 91 924 63 138 772 745 291 383 394 388 286 371 958 893 333 933 949 914 337 588 400 610 920 238 342 824 564 236 852 619 786 143 507 183 158 398 404 121 161 436 106 107 259 731 774 978 293 642 483 357 283 921 216 37 987 219 317 481 117 974 241 955 940 583 291 998 103 900 645 185 909 659 407 379 958 620 565 961 991 902 768 844 52 148 515 454 560 977 939 204 703 373 655 442 645 536 231 273 386 9 744 144 769 789 505 593 36 521 505 90 559 805 341 482 840 104 376 155 642 744 682 650 185 18 875 142 620 447 283 898 670 864 38 531 156 87 570 649 343 596 667 286 468 820 768 306 571 350 352 843 742 621 376 714 209 408 489 657 278 759 350 200 971 849 778 934 382 587 586 972 166 718 908 438 297 600 555 860 211 771 410 491 711 950 185 672 578 114 903 551 626 854 332 648 92 311 200 988 614 596 455 785 726 760 999 953 765 52 316 27 318 418 134 453 835 941 834 571 865 188 601 23 410 240 411 805 300 530 844 606 88 448 347 620 916 118 13 552 998 646 186 103 851 606 165 824 166 551 91 869 283 819 652 828 518 991 591 537 257 939 129 468 568 501 305 87 299 500 954 320 60 980 487 133 224 255 903 50 111 605 488 333 804 240 468 455 631 433 490 461 205 594 170 752 63 392 97 890 349 954 645 2 721 594 641 486 612 486 448 789 268 176 303 171 527 887 816 543 118 86 379 654 393 895 853 123 784 536 317 94 943 153 862 551 486 34 341 686 506 467 800 22 516 207 785 433 296 802 75 559 187 848 472 605 756 551 153 966 360 876 740 641 107 926 713 928 868 162 958 486 520 508 304 409 348 393 634 645 566 297 743 718 287 437 466 420 850 806 708 874 296 887 922 117 8 41 276 147 912 724 211 207 448 402 347 908 460 300 727 708 524 853 198 158 755 81 331 274 30 905 641 379 688 824 55 769 194 237 484 574 972 160 82 307 564 25 302 625 587 747 95 31 456 286 709 361 713 449 350 117 882 812 626 943 182 222 67 770 95 503 252 476 729 670 979 216 183 175 727 934 591 428 152 932 367 146 688 826 225 848 412 628 902 185 215 189 190 654 977 739 756 617 870 815 474 526 153 413 466 672 811 829 797 789 172 270 846 380 206 994 686 656 544 420 428 592 407 387 348 722 495 504 838 922 627 303 625 636 360 756 475 699 68 540 581 154 17 345 184 237 746 419 483 15 712 489 820 982 470 190 229 317 878 118 858 361 705 692 507 356 781 61 475 401 287 391 206 103 111 34 748 425 218 190 883 763 852 928 892 403 11 623 307 112 28 132 684 759 304 327 371 557 181 929 496 723 723 913 907 95 674 187 591 519 211 606 191 629 164 869 590 974 297 309 166 321 849 102 274 356 30 942 673 935 331 828 136 512 549 198 233 345 195 263 327 617 506 98 147 667 653 696 925 103 829 966 963 693 847 366 675 586 530 707 598 575 666 423 614 857 549 517 629 951 159 227 244 250 835 400 571 949 914 497 153 959 160 131 142 768 983 52 261 113 372 528 830 767 204 149 81 684 64 175 275 268 27 689 677 535 887 977 269 498 180 767 207 189 970 156 392 373 774 348 229 112 181 593 582 66 712 48 170 603 191 626 174 536 465 295 621 587 570 691 180 479 604 361 374 890 384 434 861 380 651 19 342 801 24 171 868 609 116 841 805 3 227 827 486 755 815 372 605 172 516 729 772 640 805 701 228 825 543 892 619 699 554 176 921 221 41 661 25 675 174 264 257 392 364 854 117 811 830 814 803 617 844 773 698 997 654 227 812 899 430 719 368 535 789 285 90 273 330 885 493 500 383 640 448 998 640 761 555 853 646 230 410 965 167 427 688 772 317 106 68 873 935 360 406 886 132 441 266 996 82 642 834 342 147 713 508 609 130 688 960 915 13 330 254 386 848 882 705 586 542 180 513 337 181 742 835 296 176 882 906 103 963 501 9 793 196 727 579 670 397 223 495 799 773 571 666 828 515 847 341 893 204 174 179 926 93 767 27 851 940 756 496 757 748 852 902 342 245 752 872 628 184 15 918 193 582 45 602 932 812 718 465 670 88 149 783 796 220 43 336 440 717 135 800 613 207 203 96 188 911 266 972 524 363 629 416 56 894 622 5 182 416 2 128 355 935 206 167 338 807 872 54 243 176 286 347 88 235 727 894 306 880 981 395 842 132 659 695 233 186 344 425 318 289 987 706 37 730 441 973 149 113 482 632 494 721 185 177 906 239 61 595 758 321 927 392 599 457 91 312 342 434 63 891 987 190 670 302 894 241 148 574 255 988 515 135 473 84 282 835 870 772 351 21 259 550 776 6 694 774 909 268 892 844 334 25 658 434 924 398 880 811 272 257 575 690 763 955 763 186 523 612 899 412 555 287 987 945 425 375 499 930 956 839 663 826 557 411 772 899 926 751 664 396 118 654 647 956 151 777 748 236 610 41 310 902 988 828 650 114 821 292 708 384 48 668 330 224 367 214 154 288 826 542 819 856 299 419 592 325 974 783 363 81 524 636 349 530 116 673 797 305 45 8 427 650 330 98 341 792 279 48 668 634 674 779 262 497 942 162 339 711 381 125 99 813 284 890 975 765 612 971 383 76 638 286 523 994 890 761 40 922 575 95 124 60 587 944 938 856 147 629 91 219 110 626 251 621 972 514 890 137 648 761 580 207 179 711 214 380 615 415 47 622 452 469 438 790 178 891 765 748 683 130 44 223 479 748 417 889 994 933 824 377 443 0 845 866 118 242 920 669 306 29 880 745 404 841 35 403 225 999 816 548 948 225 362 681 611 803 254 554 599 28 62 793 65 838 230 25 852 19 350 62 36 123 834 462 874 301 509 350 595 568 761 739 170 649 390 710 930 415 477 707 642 130 234 912 473 140 944 122 55 419 856 798 760 352 104 994 139 479 530 701 415 472 555 696 863 496 129 407 888 230 107 442 608 259 340 357 820 261 172 980 257 362 17 97 176 345 166 588 453 913 2 167 500 55 377 729 532 651 955 919 955 879 977 965 870 626 37 985 999 72 133 969 673 864 495 364 835 789 395 743 441 668 467 347 20 281 815 372 623 465 583 765 856 193 478 939 211 366 169 269 439 232 398 423 283 847 119 626 502 770 950 690 735 202 765 245 426 137 310 924 730 691 296 407 49 658 565 94 591 539 549 931 156 714 447 303 160 190 238 235 767 357 892 119 874 484 942 24 622 276 841 239 51 663 408 72 468 135 2 75 158 369 993 828 47 580 492 113 50 39 312 811 903 441 567 155 436 367 404 18 389 923 864 764 86 727 984 823 505 816 869 544 522 737 600 86 444 3 532 68 200 359 756 440 979 818 225 587 439 199 326 989 55 20 499 832 599 919 814 880 243 438 310 535 267 929 287 479 905 544 669 503 438 743 38 118 216 530 903 345 974 696 312 635 421 628 974 198 816 901 630 191 948 744 534 57 716 621 567 70 266 676 673 544 502 463 21 450 605 452 545 228 104 61 295 351 933 573 305 836 880 136 573 253 798 197 64 943 954 130 587 89 937 555 797 17 617 783 556 595 760 125 382 881 1 346 702 237 103 349 242 970 558 322 918 186 870 940 245 957 89 903 406 69 451 51 833 621 331 506 334 463 30 847 556 23 338 78 857 356 184 268 454 371 192 73 42 51 379 9 986 142 771 261 526 230 263 14 435 334 583 786 971 159 864 6 995 923 931 121 640 243 92 854 967 895 907 846 641 422 157 795 766 426 957 393 679 112 793 807 676 85 42 182 361 681 415 673 543 131 635 799 391 664 579 499 855 272 60 126 203 209 393 752 886 474 929 597 856 461 730 75 863 667 681 963 266 869 403 431 332 451 477 258 73 626 657 358 176 147 946 856 725 727 618 368 967 788 561 775 590 358 576 770 603 899 609 662 162 595 228 468 410 173 54 93 672 634 268 499 161 370 757 113 686 20 940 365 702 62 834 177 489 608 445 427 112 46 147 886 334 215 326 911 614 546 174 205 861 199 209 304 655 536 776 46 263 429 525 171 857 786 604 391 16 371 110 687 783 481 159 369 221 262 782 416 703 511 745 931 903 601 304 119 800 774 841 49 806 417 341 627 522 93 618 590 523 46 302 73 996 600 630 277 10 395 188 0 724 674 920 403 810 893 828 148 980 789 45 200 550 635 135 951 612 868 780 21 534 407 259 14 183 988 497 764 481 591 757 132 647 533 483 171 750 163 179 612 5 150 687 933 593 251 674 946 620 97 668 753 274 982 519 116 141 835 727 781 101 597 681 68 236 962 498 68 702 41 801 138 551 832 483 975 109 512 227 467 612 468 302 666 456 691 974 692 598 598 645 125 370 621 740 438 177 930 195 332 369 458 356 415 848 6 14 524 822 575 301 131 486 229 160 696 308 731 163 533 22 919 516 753 416 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 1 Time taken for selection sort: 144 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 2 Time taken for bubble sort: 251 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 3 Time taken for insertion sort: 48 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 1 Same as the previous input Time taken for selection sort: 130 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 2 Same as the previous input Time taken for bubble sort: 119 Histogram of random array sorted using different sorting techniques Algorithm run time Histogram 1 130 ********************************************************************************************************************************** 2 119 *********************************************************************************************************************** 3 48 ************************************************ Choose one of the following types of data sets a.Random array b.Sorted array c.Reversed array Enter the data type:

OpenStudy (ajprincess):

when I enter 1 again it doesn't exit though it prints same as previous input

ganeshie8 (ganeshie8):

maybe for testing, remove the "switch" statement, and see whats going on ?

ganeshie8 (ganeshie8):

run only below code and see if it is working as expected :

ganeshie8 (ganeshie8):

``` public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; int t=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; int pre[]=new int[10]; while(j<5) { algoType=getAlgoType(); for(int i=0; i<=9; i++) { if(algoType==pre[i]) { System.out.println("Same as previous, Exiting ! "); return; } } System.out.println("New value, Appending... "); pre[t++]=algoType; j++; } } ```

OpenStudy (ajprincess):

output: Enter the number of times: 1 Please enter different choice for data sets and algorithm in each iteration Choose one of the following types of data sets a.Random array b.Sorted array c.Reversed array Enter the data type: a Random array is: 768 667 399 415 828 492 321 809 974 361 Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 1 New value, Appending... Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 2 New value, Appending... Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 3 New value, Appending... Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 1 Same as the previous input New value, Appending... Choose any one of the following sorting algorithms 1.Selection sort 2.Bubble sort 3.Insertion sort 4.Merge sort 5.Quick sort Enter your choice: 2 Same as the previous input New value, Appending... Histogram of random array sorted using different sorting techniques Algorithm run time Histogram 1 0 2 0 3 0 4 0 5 0 Choose one of the following types of data sets a.Random array b.Sorted array c.Reversed array Enter the data type: g

ganeshie8 (ganeshie8):

It is working, it is printing out : Enter your choice: 1 Same as the previous input

ganeshie8 (ganeshie8):

Since you're using it inside a function, I think you need to use "exit" or something instead of "return"

ganeshie8 (ganeshie8):

Try this : ``` public static long[] selectAlgoType(int[] a,int[] a1,int[] a2, int[] a3,int[]a4) { int j=0; int t=0; long startTime, endTime; long d[]=new long[5]; int prev=0; int algoType; int pre[]=new int[10]; while(j<5) { algoType=getAlgoType(); for(int i=0; i<=9; i++) { if(algoType==pre[i]) { System.out.println("Same as previous, Exiting ! "); System.exit(0); } } System.out.println("New value, Appending... "); pre[t++]=algoType; j++; } } ```

OpenStudy (ajprincess):

works fine:)

ganeshie8 (ganeshie8):

yaaaayy xD

ganeshie8 (ganeshie8):

i think "return" is simply returning to the "caller function", instead of exiting from the program

OpenStudy (ajprincess):

if i want to print the histogram for the runtimes printed till the input same as the previous how can i edit my histogram method.

OpenStudy (ajprincess):

must be so.:)

ganeshie8 (ganeshie8):

you're already printing out histogram right ? ``` Histogram of random array sorted using different sorting techniques Algorithm run time Histogram 1 130 ********************************************************************************************************************************** 2 119 *********************************************************************************************************************** 3 48 ************************************************ ```

ganeshie8 (ganeshie8):

this looks neat to me :)

OpenStudy (ajprincess):

ya. there is an error in it. when the loop for the dataType runs twice the histogram is printed twice

ganeshie8 (ganeshie8):

Oh, you want to print histogram ONLY BEFORE EXIATING the program ?

ganeshie8 (ganeshie8):

*EXITING

OpenStudy (ajprincess):

ya.

OpenStudy (ajprincess):

i think it is gonna get pretty complicated

ganeshie8 (ganeshie8):

nope, just move ur "switch" statement out of while loop

ganeshie8 (ganeshie8):

``` char p=0; while(j<3) { System.out.println("Choose one of the following types of data sets"); System.out.print("a.Random array\nb.Sorted array\nc.Reversed array\n"); System.out.print("Enter the data type: "); char dataType=s.next().charAt(0); int i=0; if(dataType==p) { return ; } else { p=dataType; switch(dataType) { case 'a': System.out.print("Random array is: "); print(a); d=selectAlgoType(A,A1,A2,A3,A4); System.out.println("Histogram of random array sorted using different sorting techniques"); histogram(d); break; case 'b': System.out.print("Sorted array is: "); print(b); d=selectAlgoType(B,B1,B2,B3,B4); System.out.println("Histogram of sorted array sorted using different sorting techniques"); histogram(d); break; case 'c': System.out.print("Reversed array is: "); print(c); d=selectAlgoType(C,C1,C2,C3,C4); System.out.println("Histogram of reverse ordered array sorted using different sorting techniques"); histogram(d); break; default: System.exit(0); } } j++; } ```

ganeshie8 (ganeshie8):

Is that your histogram function ?

ganeshie8 (ganeshie8):

I dont understand ur project fully yet...

OpenStudy (ajprincess):

`public static void histogram(long array[]) { String output = "Algorithm\trun time\tHistogram"; for ( int count = 0; count <array.length; count++ ) { if((count+1)<=5) { output += "\n" + (count+1) + "\t\t" + array[ count ] + "\t\t"; } else if((count+1)<=10) { output += "\n" + ((count+1)-5) + "\t\t" + array[ count ] + "\t\t"; } else { output += "\n" + ((count+1)-10) + "\t\t" + array[ count ] + "\t\t"; } for ( int stars = 0; stars < array[ count]; stars++ ) { output += "*"; } } System.out.println(output); }`

OpenStudy (ajprincess):

that is my hisogram

ganeshie8 (ganeshie8):

okay, and what u wana do ha

ganeshie8 (ganeshie8):

sorry i hav no clue what the error in histogram function itself yet ;(

ganeshie8 (ganeshie8):

the histogram function is looking fine to me ?

OpenStudy (ajprincess):

ya it is k. this will print the histogram for all 5 sorting techniques for different types of data sets. whn I enter inputs same as the previous input the program will exit and before exiting it would have printed runtimes for my inputs. isn't it. i want to print the histogram for that inputs. say my inputs for algorithm types are 1,2,3 and again 1. till i give 1 it would hav printed time taken right. i want to print histogram for those three inputs,

ganeshie8 (ganeshie8):

Gotcha :) so u dont wanto exit abruptly right after finding the same previous input

ganeshie8 (ganeshie8):

you wanto print histogram for watever inputs that were entered previously and exit.

ganeshie8 (ganeshie8):

I see..

OpenStudy (ajprincess):

yup:)

ganeshie8 (ganeshie8):

its easy actually

ganeshie8 (ganeshie8):

just declare another variable : exit_status

ganeshie8 (ganeshie8):

and set it to 1, when u find same previous input. check it just after printing out histograms and exit ?

ganeshie8 (ganeshie8):

hmm may not be that simple, give it a try... i dont follow the entire code though..

OpenStudy (ajprincess):

This is the question for my mini project *Create an array A which holds 10000 random numbers *Sort the data and store it in another array B *Sort the data in reverse order and store it in another array C(using any sorting method) *Determine the running time of all sorting algorithms when the input data is 1.random input 2.reverse-ordered input 3.sorted input using the below algorithms in each data set. a)Selection sort b)Bubble sort c)Insertion sort d)Merge sort e)Quick sort *You should create a new menu to select the data-sets(random array/reverse array/sorted array) and algorithms as well. *Plot graphs for all three cases(algorithm Vs run time)

ganeshie8 (ganeshie8):

okay ! i think you almost finished ur project.. like 95%.. good :)

ganeshie8 (ganeshie8):

who gave this weird requirement that, the problem should exit if u enter the same input two times ha ?

OpenStudy (ajprincess):

thnx:) lol no one.

OpenStudy (ajprincess):

I got nly got that weird idea

ganeshie8 (ganeshie8):

hahah okay nice :) For prining histograms before exiting, I think you're going to play with code a bit.. might take few iterations... good luck :)

OpenStudy (ajprincess):

Thnx. I dnt thnk I will be able to do it nw. I hav to prepare for another test. so gonna sent my last code. thank u so much for helping me.:D

ganeshie8 (ganeshie8):

np :) wish you all the best !!

OpenStudy (ajprincess):

thnx.:)

OpenStudy (ajprincess):

for random array the time taken by the algorithms Q<M<I<S<B for sorted array the time taken by the algorithms I<M<Q<B<S for reverse sorted array the time taken by the algorithms Q<M<I<S<B is this right?

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!