# need program logic

Show 40 post(s) from this thread on one page
Page 1 of 3 123 Last
• 04-25-2013, 02:57 PM
anonymouss
need program logic
hi, i am java learner,so i need some programs anyone can able to post here or give some logics
• 04-25-2013, 03:42 PM
PhHein
Re: need program logic
Plenty here: The Really Big Index
• 04-25-2013, 05:53 PM
JosAH
Re: need program logic
Here's another one (A and B are boolean expressions):

!(A || B) == !A && !B

and

!(A && B) == !A || !B

mostly done wrong in situations where you have your brain powered off ...

kind regards,

Jos
• 04-25-2013, 06:26 PM
anonymouss
Re: need program logic
hi to all, is it possible comparing two arrays and remove duplicates and written in a single array
• 04-25-2013, 06:49 PM
JosAH
Re: need program logic
Are you ignoring previous replies by starting just another unrelated question in the same thread?

Jos
• 04-25-2013, 07:44 PM
anonymouss
Re: need program logic
Quote:

Originally Posted by JosAH
Here's another one (A and B are boolean expressions):

!(A || B) == !A && !B

and

!(A && B) == !A || !B

mostly done wrong in situations where you have your brain powered off ...

kind regards,

Jos

what is this,iam not getting,and im not ignoring
• 04-25-2013, 08:02 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
what is this,iam not getting,and im not ignoring

Those are De Morgan's laws; they are very fundamental laws in Boolean logic and mostly misunderstood.

kind regards,

Jos
• 04-25-2013, 09:17 PM
anonymouss
Re: need program logic
Quote:

Originally Posted by JosAH
Those are De Morgan's laws; they are very fundamental laws in Boolean logic and mostly misunderstood.

kind regards,

Jos

ok but iam looking for this if we provide two arrays with duplicate values we have to remove duplicate and print the values as a single array
• 04-25-2013, 09:28 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
ok but iam looking for this if we provide two arrays with duplicate values we have to remove duplicate and print the values as a single array

No you were not; you were looking for (and I quote here):

Quote:

hi, i am java learner,so i need some programs anyone can able to post here or give some logics
and you got two replies and you never gave an answer to them.

Jos
• 04-26-2013, 07:42 AM
anonymouss
Re: need program logic
Quote:

Originally Posted by PhHein

k thankx but iam not basic learner, i have some doubts which regarding to programs and expecting some program to implement with help of u

Quote:

Originally Posted by JosAH
No you were not; you were looking for (and I quote here):

why it is not possible ,for example i l say int a[]={5,4,2,1}; and int b[]={5,6,2,8};
the output will be 5,4,6,2,8,1
2)what about this 2,10,15,2 add the elements in command line argument and remove duplicates?
• 04-26-2013, 08:51 AM
SurfMan
Re: need program logic
Quote:

Originally Posted by anonymouss
k thankx but iam not basic learner, i have some doubts which regarding to programs and expecting some program to implement with help of u
why it is not possible ,for example i l say int a[]={5,4,2,1}; and int b[]={5,6,2,8};
the output will be 5,4,6,2,8,1
2)what about this 2,10,15,2 add the elements in command line argument and remove duplicates?

What code have you got so far? You obviously understand that you came to java-forums.org, not rent-a-coder.com?
• 04-26-2013, 02:21 PM
anonymouss
Re: need program logic
iam not asking to write the program or write the enter code, let me clear int a[]={2,10,15,2 ,8};i want to remove duplicates and writted output as 2,10,15,8,how to remove duplicates if anyone have idea or logic just tell me then i will implement
• 04-26-2013, 02:29 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
iam not asking to write the program or write the enter code, let me clear int a[]={2,10,15,2 ,8};i want to remove duplicates and writted output as 2,10,15,8,how to remove duplicates if anyone have idea or logic just tell me then i will implement

Put them in a Set<Integer> and create a new array from that set.

kind regards,

Jos
• 04-26-2013, 02:34 PM
anonymouss
Re: need program logic
yeah i know set does not allow duplicate elements,so i want to remove them without using collections
• 04-26-2013, 02:51 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
yeah i know set does not allow duplicate elements,so i want to remove them without using collections

Ah, you want a cripple 'beginners' solution with for- and while-loops, a few if-statements here and there and possibly a few funny flags instead? How strange ...

Jos
• 04-26-2013, 02:56 PM
PhHein
Re: need program logic
Quote:

Originally Posted by anonymouss
yeah i know set does not allow duplicate elements,so i want to remove them without using collections

Should be no problem for you:
Quote:

iam not basic learner
• 04-26-2013, 03:08 PM
anonymouss
Re: need program logic
Quote:

Originally Posted by PhHein
Should be no problem for you:

ha,but struck up with logic
• 04-26-2013, 03:14 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
ha,but struck up with logic

There is (almost) no logic at the application level in the suggestion in reply #13.

Jos
• 04-26-2013, 03:24 PM
anonymouss
Re: need program logic
Quote:

Originally Posted by JosAH
There is (almost) no logic at the application level in the suggestion in reply #13.

Jos

k thanks i ll try myself, k let me tell java doesnot execute line by line then how to understand program when we are looking at ,i want to know exceution process for below program
Code:

``` public class Bubblesort {         public static void main(String arsg[])         {                   int i;                   int array[] = {12,5,4,85,18,1,3,10};                   System.out.println("Values Before the sort:\n");                   for(i = 0; i < array.length; i++)                                   System.out.print( array[i]+"  ");                 System.out.println();                                   int n=array.length;                   bubble_srt(array, array.length);                                   System.out.print("Values after the sort:\n");                   for(i = 0; i <array.length; i++)                   System.out.print(array[i]+"  ");                   System.out.println();                   System.out.println("PAUSE");           }           public static void bubble_srt( int a[], int n )                 {                   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])                                 {                                           t = a[j-1];                                           a[j-1]=a[j];                                           a[j]=t;                                   }                           }                   }           } }```
• 04-26-2013, 05:50 PM
JosAH
Re: need program logic
Quote:

Originally Posted by anonymouss
k thanks i ll try myself, k let me tell java doesnot execute line by line then how to understand program when we are looking at ,i want to know exceution process for below program

You haven't written this code yourself, have you? Otherwise you wouldn't have asked this. And please stop asking different questions all the time without properly discussing the replies to your previous questions.

Jos
Show 40 post(s) from this thread on one page
Page 1 of 3 123 Last