Re: [algogeeks] Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread vishal chaudhary
hi all,
yes you can do it that way, but the thing is why are you increasing the
complexity of the problem by again checking the inorder traversal output to
be checked for increasing order.
just traverse through the ones recursively(as we do it in the inoder
traversal) through all the nodes and check whether the left child is less
than the root and root is smaller than the right node.


Warm Regards
Vishal Chaudhary
BE(Hons) Computer Science and Engineering
BITS Pilani





On Tue, Nov 6, 2012 at 12:34 AM, shady  wrote:

> Hi,
> Can we check this by just doing an inorder traversal, and then checking if
> it is in increasing order or not ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] output of the program with explanation

2012-11-05 Thread rahul patil
its because it is integer pointer subtraction, So  subtraction  result will
be divided by integer size.

so 30/4 = 7.

2012/11/6 rajesh pandey 

> *int *x ,int *y;
> x=(int *) 50;
> y=(int *)20;
> cout<
> why the output is 7.*
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/wgVXAzGRgU4J.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Regards,
Rahul Patil

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] output of the program with explanation

2012-11-05 Thread rajesh pandey
*int *x ,int *y;
x=(int *) 50;
y=(int *)20;
cout

Re: [algogeeks] Time Complexity Analysis

2012-11-05 Thread atul anand
building tree will take O(n) time but for each node we need to find max i.e
  i = max (inorder, start, end);

so complexity in worst case will we O(n^2).

On Tue, Nov 6, 2012 at 12:26 AM, shady  wrote:

> Sorting takes linear time, but it doesnt get repeated n times,
>
> it is like - T(n) = 2*T(n/2) + O(n)
>
> worst case solution is O(n^2)
>
> it is similar to quick sort
>
>
> On Mon, Nov 5, 2012 at 9:15 PM, rahul sharma wrote:
>
>> dude n for build tree and n in this for finding maximun??so n*(n/2)=o(n^2)
>>
>> On Mon, Nov 5, 2012 at 8:54 PM, shady  wrote:
>>
>>> Here the time complexity of the solution should be O(n * log(n))
>>> http://www.geeksforgeeks.org/archives/21781
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread CHIRANJEEV KUMAR
@Don,
Your method fails for the case below:

//Check if a binary tree is Binary Search Tree or not.
#include
typedef struct node
{
int value;
struct node *left,*right;
}nodeptr;
nodeptr *newnode(int x)
{
nodeptr* tmp = (nodeptr*)malloc(sizeof(nodeptr));
tmp->value=x;
tmp->left=NULL;
tmp->right=NULL;
return tmp;
}
int isBinTree(struct node *t)
{
   return (!t) || ((!t->left || (t->value > t->left->value)) &&
   (!t->right || (t->value < t->right->value)) &&
   isBinTree(t->left) && isBinTree(t->right));
}
int main()
{
/*
This is not a BST
50
  /\
 40 60
  \
  55
*/
nodeptr *root=NULL;
root = newnode(50);
root->left = newnode(40);
root->right=newnode(60);
root->left->right = newnode(55);
printf("%s\n",isBinTree(root)?"It is a BST":"It is not a BST");
}











On Tue, Nov 6, 2012 at 3:10 AM, shady  wrote:

> Understood, thanks.
>
>
> On Tue, Nov 6, 2012 at 2:35 AM, Don  wrote:
>
>> In English, that is
>>
>> A null tree is a binary tree.
>> Otherwise, it's a binary tree if the root value is greater than the
>> left child and less than the right child, and the left and right
>> subtrees are binary trees.
>>
>> Don
>>
>> On Nov 5, 2:48 pm, Don  wrote:
>> > That would work. But a simpler approach is:
>> >
>> > bool isBinTree(root *t)
>> > {
>> >return (!t) || ((!t->left || (t->value > t->left->value)) &&
>> >(!t->right || (t->value < t->right->value)) &&
>> >isBinTree(t->left) && isBinTree(t->right));
>> >
>> > }
>> >
>> > On Nov 5, 2:04 pm, shady  wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Hi,
>> > > Can we check this by just doing an inorder traversal, and then
>> checking if
>> > > it is in increasing order or not ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread atul anand
@Don : your algo wont work for following tree :-

   30
  /  \
 20   31
   /  \
  9   41

above tree is not a BST bcozz here 41 should lie on the right side of the
30but it is not.
so we need to keep track of max and min as we move left or right part of
the tree.and each node should lie b/w that min and max range.
for more details : http://www.geeksforgeeks.org/archives/3042

@shady : yes correct..you can do in that way.

On Tue, Nov 6, 2012 at 1:18 AM, Don  wrote:

> That would work. But a simpler approach is:
>
> bool isBinTree(root *t)
> {
>return (!t) || ((!t->left || (t->value > t->left->value)) &&
>(!t->right || (t->value < t->right->value)) &&
>isBinTree(t->left) && isBinTree(t->right));
> }
>
> On Nov 5, 2:04 pm, shady  wrote:
> > Hi,
> > Can we check this by just doing an inorder traversal, and then checking
> if
> > it is in increasing order or not ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread shady
Understood, thanks.

On Tue, Nov 6, 2012 at 2:35 AM, Don  wrote:

> In English, that is
>
> A null tree is a binary tree.
> Otherwise, it's a binary tree if the root value is greater than the
> left child and less than the right child, and the left and right
> subtrees are binary trees.
>
> Don
>
> On Nov 5, 2:48 pm, Don  wrote:
> > That would work. But a simpler approach is:
> >
> > bool isBinTree(root *t)
> > {
> >return (!t) || ((!t->left || (t->value > t->left->value)) &&
> >(!t->right || (t->value < t->right->value)) &&
> >isBinTree(t->left) && isBinTree(t->right));
> >
> > }
> >
> > On Nov 5, 2:04 pm, shady  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi,
> > > Can we check this by just doing an inorder traversal, and then
> checking if
> > > it is in increasing order or not ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread Don
In English, that is

A null tree is a binary tree.
Otherwise, it's a binary tree if the root value is greater than the
left child and less than the right child, and the left and right
subtrees are binary trees.

Don

On Nov 5, 2:48 pm, Don  wrote:
> That would work. But a simpler approach is:
>
> bool isBinTree(root *t)
> {
>    return (!t) || ((!t->left || (t->value > t->left->value)) &&
>                    (!t->right || (t->value < t->right->value)) &&
>                    isBinTree(t->left) && isBinTree(t->right));
>
> }
>
> On Nov 5, 2:04 pm, shady  wrote:
>
>
>
>
>
>
>
> > Hi,
> > Can we check this by just doing an inorder traversal, and then checking if
> > it is in increasing order or not ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread Don
That would work. But a simpler approach is:

bool isBinTree(root *t)
{
   return (!t) || ((!t->left || (t->value > t->left->value)) &&
   (!t->right || (t->value < t->right->value)) &&
   isBinTree(t->left) && isBinTree(t->right));
}

On Nov 5, 2:04 pm, shady  wrote:
> Hi,
> Can we check this by just doing an inorder traversal, and then checking if
> it is in increasing order or not ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Check if a binary tree is Binary Search Tree or not.

2012-11-05 Thread shady
Hi,
Can we check this by just doing an inorder traversal, and then checking if
it is in increasing order or not ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] swap objects without temp variable

2012-11-05 Thread Shivam Rohilla
in a single line
a^=b^=a^=b;

On 05/11/2012, atul anand  wrote:
> a=a^b;
> b=a^b;
> a=a^b;
>
> need to check if a and b are equal or not , bcozz a^a =0
>
> On Mon, Nov 5, 2012 at 2:02 AM, manish  wrote:
>
>> Swapping two objects (not integers/chars),without using temp...?
>> my solution is using xor operation..is that right and ny other solutions
>> ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: swap objects without temp variable

2012-11-05 Thread Umer Farooq
But how is that going to work for objects?

On Mon, Nov 5, 2012 at 6:43 AM, Ashok Varma  wrote:

> Try this: a = a + b - (b = a); //single line code to swap
>
>
>
>
> On Mon, Nov 5, 2012 at 4:53 AM, Dave  wrote:
>
>> @Manish: Sure.
>>
>> a = a + b;
>> b = a - b;
>> a = a - b;
>>
>> In 2-s complement arithmetic, it works even if a + b overflows.
>>
>> Dave
>>
>> On Sunday, November 4, 2012 2:32:43 PM UTC-6, manish wrote:
>>
>>> Swapping two objects (not integers/chars),without using temp...?
>>> my solution is using xor operation..is that right and ny other solutions
>>> ?
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/nc5h3uIL65AJ.
>>
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Umer

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Make File

2012-11-05 Thread s yogeesh
Makefile is a special file, containing shell commands... Some what like
Batch files for Windows...
Makefile needs "make" is a utility that automatically builds executable
programs and libraries from source code by reading files called Makefiles
which specify how to derive the target program


On Sun, Nov 4, 2012 at 6:54 PM, Ashok Varma  wrote:

> Friends, Please clarify this.
> What is a Make file ? & What is its use ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Problem in Step Into (F5) in eclipse Debugging Mode.

2012-11-05 Thread neeraj
1.  public static void main(String[] args) {
2.  HashMap hashTable =new HashMap();
3.  hashTable.put("one","one");
4.  hashTable.put("two","one");
5.   }

I put break points on line 3 and 4. When i launch my above code in
debugging mode the control reach at line 3.
and when i press F5 key then  control goes on line 4 . instead of the
HashMap put method.I have already unchecked the (Window-->Preferences--
>java-->debug-->step filtering ) options.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Make File

2012-11-05 Thread Durgesh Kumar
1>  It is a very important linux utility .
2>  If U simply type make on terminal , it will look for makefile in
the folder and subfolder and will execute it
3> If a program consists of several file eg :- main.c ,fun () in
fun.c , type () in  type.c . Now , suppose type calls fun() , main
call both fun() and type(). So before compiling type.c , fun.c must be
compiled , similarly before compiling main.c , both fun.c and type.c
must be compiled . To abstract (hide these complexity ) this
information from user , make file is written

4> If u want to  know how to write make file refer the site below
http://www.gnu.org/software/make/manual/html_node/Makefiles.html#Makefiles

5. one more interesting feature of makefile is that it doesn't
recompile  all the file . It automatically checks for  any recent
change in corresponding file , nd compile only those . thus it also
saves compiling time if file size (no of lines of code)  is too large.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] swap objects without temp variable

2012-11-05 Thread Abhishek Jha
yep its right.one mre method will be

a=a+b;
b=a-b;
a=a-b;



On Mon, Nov 5, 2012 at 2:02 AM, manish  wrote:

> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: OS question..

2012-11-05 Thread Varun
see, ideally for Q1, the answer the NO.
But paging has some advantage, therefore its better to have it neverthless

Q2, ??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/44rIrz0Vil8J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] swap objects without temp variable

2012-11-05 Thread vaibhav shukla
XOR option wont work for floating points so being generic, using temp
variable is the best option for swapping.
Anyways, the question requirement was to swap without temp, hence above
given solutions go right.


On Mon, Nov 5, 2012 at 10:43 AM, atul anand  wrote:

> a=a^b;
> b=a^b;
> a=a^b;
>
> need to check if a and b are equal or not , bcozz a^a =0
>
> On Mon, Nov 5, 2012 at 2:02 AM, manish  wrote:
>
>> Swapping two objects (not integers/chars),without using temp...?
>> my solution is using xor operation..is that right and ny other solutions
>> ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/algogeeks/-/OxVSnZ1QjzMJ.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
best wishes!!
 Vaibhav

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Time Complexity Analysis

2012-11-05 Thread shady
Sorting takes linear time, but it doesnt get repeated n times,

it is like - T(n) = 2*T(n/2) + O(n)

worst case solution is O(n^2)

it is similar to quick sort

On Mon, Nov 5, 2012 at 9:15 PM, rahul sharma wrote:

> dude n for build tree and n in this for finding maximun??so n*(n/2)=o(n^2)
>
> On Mon, Nov 5, 2012 at 8:54 PM, shady  wrote:
>
>> Here the time complexity of the solution should be O(n * log(n))
>> http://www.geeksforgeeks.org/archives/21781
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: swap objects without temp variable

2012-11-05 Thread Don
Note that most of these methods fail if you try to swap an item with
itself.

For example, swap(a[i], a[j]) will fail if i==j and swap is
implemented as

void swap(int &a, int&b)
{
   a ^= b;
   b ^= a;
   a ^= b;
}

Don

On Nov 4, 3:32 pm, manish  wrote:
> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Re: Make File

2012-11-05 Thread Don
A Makefile is used by "make" to build multi-file programs. It usually
contains information about the dependencies in the project and
instructions on how to build each portion, and then how to link them
all together into the final executable. Make will look at the time
stamps on the files and determine which object files are out of date,
and only recompile what is necessary. There are additional uses, but
that is the main concept behind make.
Don

On Nov 4, 8:24 am, Ashok Varma  wrote:
> Friends, Please clarify this.
> What is a Make file ? & What is its use ?

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Time Complexity Analysis

2012-11-05 Thread rahul sharma
dude n for build tree and n in this for finding maximun??so n*(n/2)=o(n^2)

On Mon, Nov 5, 2012 at 8:54 PM, shady  wrote:

> Here the time complexity of the solution should be O(n * log(n))
> http://www.geeksforgeeks.org/archives/21781
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Time Complexity Analysis

2012-11-05 Thread shady
Here the time complexity of the solution should be O(n * log(n))
http://www.geeksforgeeks.org/archives/21781

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] OS question..

2012-11-05 Thread Prabagaran Thangavel
@manish

Q1. Paging has various advantages.
 1. Increase the process address space to 4 GB (assuming 32 bit address
and data bus) even if physical memory is less than 4 GB.
 2. Provides Security through Virtual Memory. Each process has its own
physical address space and cannot interfere with other process.
 It is upto the designer to choose whether to use paging or not.
Suppose you are designing an embedded system(like traffic indicator) you
can go without paging.
For a mobile operating system , it is always better to have paging since
number of applications can vary at run time during the lifetime of the
phone.
Q2. Can you explain the qn bit more.

Thanks and Regards,
Prabagaran.

Thanks and Regards,
Prabagaran.



On Mon, Nov 5, 2012 at 7:14 AM, Hanlei Qin  wrote:

> I think the answer to Q1 may "Yes".
> Cause the virtual memory of program is limited, they need logically
> contiguous memory, and have limit from OS and processor(32-bit, or
> 64-bit) yet.
> I have no idea about Q2.
>
>
> On Mon, Nov 5, 2012 at 4:30 AM, manish  wrote:
> > Q1.  If we have infinite memory, then do we still be needing paging?
> > Q2. Given only 8bits registers, you have to find average of 4 bit
> registers
> > values without using any operation involving 16 bit calculations.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Algorithm Geeks" group.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msg/algogeeks/-/iUT57I-DOHoJ.
> > To post to this group, send email to algogeeks@googlegroups.com.
> > To unsubscribe from this group, send email to
> > algogeeks+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/algogeeks?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.