you can set your directory path in this line
char *home="/home/navin/temp/";
On Sun, Jun 3, 2012 at 11:26 AM, Navin Kumar wrote:
>
>
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
> void dirfun(char *);
>
>
> int main()
> {
>
> char *home="/home/nav
#include
#include
#include
#include
#include
#include
#include
void dirfun(char *);
int main()
{
char *home="/home/navin/temp/";
dirfun(home);
return 0;
}
void dirfun(char *path)
{
struct dirent *dir;
DIR *dp= opendir(path);
if(dp!=NULL)
i wrote this program in college labbut used shell script to
simulate ls -r functionality.
now to do in c or java .. we only need to knw about the libraries to use.
On 6/3/12, Ashish Goel wrote:
> ls-r implementation needed...
>
>
> Best Regards
> Ashish Goel
> "Think positive and find fuel in
ls-r implementation needed...
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
--
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
1- read all elements of list into stack
2- max = stak.pop()
3- if stack.empty() goto 7
4- next=stack.pop()
5- if next > max then max=next
else delete next from list
6- repeat from 3
7- end!
Regards,
On Thu, May 31, 2012 at 9:45 PM, atul anand wrote:
> @navin : +1
>
> On 5/31/12, Navin Kuma
@navin : +1
On 5/31/12, Navin Kumar wrote:
> I think the easiest method to do this problem is this:
>
> http://k2code.blogspot.in/2011/09/deleting-node-in-singly-linked-list-if.html
>
> On Thu, May 31, 2012 at 5:58 PM, Ashish Goel wrote:
>
>> that is what i have done by using recursion<=>stack.
if i am getting this questions correctly then we have to delete the element
till its next is not null ??
please comment if i am wrong ?
On Thu, May 31, 2012 at 5:58 PM, Ashish Goel wrote:
> that is what i have done by using recursion<=>stack.
>
> my code has problem, after free(pCurr);, i shoul
I think the easiest method to do this problem is this:
http://k2code.blogspot.in/2011/09/deleting-node-in-singly-linked-list-if.html
On Thu, May 31, 2012 at 5:58 PM, Ashish Goel wrote:
> that is what i have done by using recursion<=>stack.
>
> my code has problem, after free(pCurr);, i should
that is what i have done by using recursion<=>stack.
my code has problem, after free(pCurr);, i should have return pRest;
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Thu, May 31, 2012 at 4:37 PM, atul anand wrote:
> then i guess ...it can
then i guess ...it can be done using stack..with O(n) complexity..
it is similar to finding next greater element
http://www.geeksforgeeks.org/archives/8405
element in the stack at the end of the algo...are the element which will
remain in the linked list . if stack is not empty then keep pop
yes
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Thu, May 31, 2012 at 2:34 PM, atul anand wrote:
> @Ashish : please clarify this ques...
>
> delete a node in SLL if it is less than *any* of the succesor node ..
>
> 1 2 8 10 3 4 7 12
>
> del
@Ashish : please clarify this ques...
delete a node in SLL if it is less than *any* of the succesor node ..
1 2 8 10 3 4 7 12
delete 1,2,8,10,3,4,7
ouput will be single node i.e 12
dats what question asks?
On Thu, May 31, 2012 at 2:16 PM, Ashish Goel wrote:
> the LL is unsorted, is there a
the LL is unsorted, is there any better solution that this?
struct node* deleteNodes(struct node *pHead, struct node *pPrev)
{
struct node *pLL = *pHead;
if (!pLL) return NULL;
struct node *pCurr = pLL;
struct node *pRest = deleteNodes(pCurr->next, pCurr);
if (!pRest) return pCurr;
i
Implement a method to perform basic string compression using the counts of
repeated characters.(inplace)
eg:- input: "aaabcdef"
output:"3a5b1c1d1e1f".
what should be my approach to this problem
if i calculate the size of array required to store the output string
and start from the last
// countIslands.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
const int rows = 5;
const int cols = 6;
bool visited[rows][cols] = {0};
int arr[rows][cols] =
{
0,0,0,0,1,1,
0,1,0,0,0,1,
1,1,0,0,0,0,
1,0,0,0,1,1,
0,0,1,0,1,0};
void initialize()
{
for (int i=0; i
First we divide the large memory into some chunks and we hash them. For
each chunk, we need hash function.
If a thread accesses a memory location, we find which chunk of address it
is accessing, then we hash based on memory location. We can easily identify
what are all threads are accessing a memor
MS IDC interview question:
Given a memory location say from 0 - 1023. Now there are many threads that
are reading and writing in this memory locations at any time 0t 1t 2t ...
and so on.
For ex a thread no.4 is writing to memory location 512 at time 3t.
So we get a quadruple {4,512,W,3t}.
Suppos
@atul anand: the question simply says that in each node the second should
point to the next larger no. which means in your case 7 3 5 1 5 9
the output should be
7->9
5->7
3->5
1->3
On Mon, Mar 26, 2012 at 10:37 AM, Dheeraj Sharma <
dheerajsharma1...@gmail.com> wrote:
> Correct me if am wrong.. i
Correct me if am wrong.. i think we can use Stack as follows
node * minFun(node *head)
{
stack st;
return fun(head,st);
}
node * fun(node *ptr,stack &st)
{
if(ptr)
{
node *x=fun(ptr->next,st);
while(!st.empty() && (ptr->data)>(st.top()->data))
after push(&s,next) move head also
head=head->next;
On Sun, Mar 25, 2012 at 12:10 AM, atul anand wrote:
> @all : i am getting this right , i guess given a linked list ...you need
> to point to next larger element.
> so if input linked list is 7 3 5 1 5 9
> then nextLarger of each node will point
@all : i am getting this right , i guess given a linked list ...you need to
point to next larger element.
so if input linked list is 7 3 5 1 5 9
then nextLarger of each node will point as follows:-
3->5
1->5
5->9
7->9
9->NULL;
i have no idea why the linked list is modified using merge sort...
any
actually, multimap can be avoided, each element of heap is key,value where
key is the element and value is address and build heap on key.
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Sat, Mar 24, 2012 at 1:40 AM, Ashish Goel wrote:
> don't kn
don't know if i am complicating..assumption,
build a multimap of values and the corresponding node address as well as a
heap from the given nodes in first pass.
now from minheap pick one by one and set the second pointer of previous
picked min element to this element using multimap(remove from mu
It is basically sorting the linked list. Do not change the first pointer of
nodes and use the second pointer for sorting. return the pointer to the
smallest element. That's it.
On Sat, Mar 24, 2012 at 12:50 AM, Atul Singh wrote:
> Given a linked list with each node having two pointers : one point
NODEPTR krev(NODEPTR head,int k)
{
NODEPTR current=head;
NODEPTR prev=NULL;
NODEPTR next;
int cnt=0;
while(current!=NULL&&cntnext;
current->next=prev;
prev=current;
current=next;
cnt++;
}
if(head!=NULL)
head->next=krev(current,k);
return prev;
}
here k=2
--
You received this message because y
struct node* revll(struct node* root)
{
return reverse(root,NULL);
}
struct node* reverse(struct node* head,struct node* prev)
{
struct node* temp1;
if(head->next==NULL)
{
head->next=prev;
return head;
}
else
{
temp1=reverse(head->next,head);
head->next=prev;
return temp1;
}
}
--
You received th
Well for odd cases its lile this
1 ->2->3->4->5
4->5->2->3->1
Also u have to do this in single pass..U can use recursion though
On Tue, Jan 24, 2012 at 12:18 AM, Arun Vishwanathan
wrote:
> node *ptr =head;
>
> //function call is reverse(head,NULL)
>
> void reverse(node *ptr, node *follow)
> {
node *ptr =head;
//function call is reverse(head,NULL)
void reverse(node *ptr, node *follow)
{
if(ptr->next!=NULL && ptr->next->next!=NULL)
reverse(ptr->next->next,ptr);
else
if(ptr->next!=NULL && ptr->next->next==NULL)
{
ptr->next->next=follow;
head=ptr;
}
ptr->ne
wat if u have odd no of nodes
On Tue, Jan 24, 2012 at 12:00 AM, atul anand wrote:
> one simple way would be using stacks.
> push node,node->next;
> then pop() , and reversing the pointers.
>
> On Mon, Jan 23, 2012 at 11:46 PM, Ankur Garg wrote:
>
>> Say LL is
>>
>> 1->2->3->4->5->6->7->8
>>
>>
one simple way would be using stacks.
push node,node->next;
then pop() , and reversing the pointers.
On Mon, Jan 23, 2012 at 11:46 PM, Ankur Garg wrote:
> Say LL is
>
> 1->2->3->4->5->6->7->8
>
> Then u need to return
>
> 7->8->5->6->3->4->1->2
>
> U cant swap the values U have to rearrange
Say LL is
1->2->3->4->5->6->7->8
Then u need to return
7->8->5->6->3->4->1->2
U cant swap the values U have to rearrange the ptr...
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googleg
Assumption here is that we can use 4K memory other than considering
the actual elements storage memory.
we were given the range of elements.. we can use count sort.
for first case, all elements are unique --> we can use 27000 bits to
represent the corresponding numbers==> takes 3375 Bytes < 4KB.
fo
Given large number of elements. All elements belong to range 1 to 27000.
First case no elements repeated and second case elements are repeated.
memory capacity is 4k. How to sort efficiently?
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To
@Himanshu
Nice idea..that shud do..but how do we code that ?
regards
Ankur
On Sat, Jan 14, 2012 at 2:23 PM, payal gupta wrote:
> @himanshu thnx..:)
>
> Regards,
> PAYAL GUPTA,
> 3rd YR ,CSE,
> NIT-BHOPAL.
>
>
> On Fri, Jan 13, 2012 at 9:42 PM, Himanshu Neema <
> potential.himansh...@gmail.com>
@himanshu thnx..:)
Regards,
PAYAL GUPTA,
3rd YR ,CSE,
NIT-BHOPAL.
On Fri, Jan 13, 2012 at 9:42 PM, Himanshu Neema <
potential.himansh...@gmail.com> wrote:
> Let a color below represent a single character in UTF-8 encoding ,
> which means that each color can span multiple bytes , In example below
Let a color below represent a single character in UTF-8 encoding ,
which means that each color can span multiple bytes , In example below I
denote one byte by one english character . i.e.
'a' or 'b' or 'c' ,etc. below takes one byte :
Let the string is :
x abc def gh ij klmn
now to reverse this
Hi
Normal string will not work I think. Because it is avriable length encoding
scheme.
On Fri, Jan 13, 2012 at 11:11 AM, b.kisha...@gmail.com wrote:
> Is there anything called in-place reversal ??
> UTF-8 is only encoding similar to ASCII but with a huge charecter set.
> So normal string revers
Is there anything called in-place reversal ??
UTF-8 is only encoding similar to ASCII but with a huge charecter set.
So normal string reversal would work fine..
On Thu, Jan 12, 2012 at 2:02 AM, Ankur Garg wrote:
> How to do this
>
> Write a function to reverse a UTF-8 encoded string in-place ??
How to do this
Write a function to reverse a UTF-8 encoded string in-place ??
--
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
alg
@ Ashish : abt the solution given by reference.
well sometimes it depends , interviewer may take it +vely as he can see you
are keen to learn abt different algorithm dats why you knw it...
On Tue, Jan 10, 2012 at 7:28 PM, Ashish Goel wrote:
> i liked the solution given by the reference i have p
@ Ramakant : yupwont work.
On Tue, Jan 10, 2012 at 7:28 PM, Ramakant Sharma wrote:
>
> @atul:
>
>
> 0 0 0 0 0 0
> -->0 1 0 0 1 0 count=2
> 0 1 1 1 1 1
>
>
>
> 0 0 0 0 0 0
> 0 1 0 0 1 0
> -->0 1 1 1 1 1 count=2 (will not change)
>
> but there is only one islandso
@atul:
0 0 0 0 0 0
-->0 1 0 0 1 0 count=2
0 1 1 1 1 1
0 0 0 0 0 0
0 1 0 0 1 0
-->0 1 1 1 1 1 count=2 (will not change)
but there is only one islandso it wouldnt work...
am i right?
--
You received this message because you are subscribed to the Google Groups
"Al
i liked the solution given by the reference i have provided. The thought
process is similar to mazing problem given in horowitz sahani.
nice question, however, how can this be an interview question?
If you give this solution, the interviewer would understand that you knew
the problem and hence wou
0 0 0 0 0 0
0 1 0 0 1 0
0 1 1 1 1 1
--
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 mo
@Ramakan:
for j=0 to col
arr[0][j]=0;
for i=0 to rows
arr[i][0]=0;
assuming that given matrix is surrounded by 0 i.e indexs (i,j) for arr[][]
will start from i=1 <= row and j=1 <= col.
i guess your approach will work.
--
You received this message because you are subscribed to the Google Group
@Ramakant : for which test case your code would fail??
On Tue, Jan 10, 2012 at 1:04 PM, Ramakant Sharma wrote:
> @atul:
> no..my approach was wrongwe have to check recursively...as sravan said
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm
http://www.janaganamana.net/onedefault.aspx?bid=276
did not get it
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Tue, Jan 10, 2012 at 1:15 PM, Ashish Goel wrote:
> this is a single island, sorry for that
>
> Best Regards
> Ashish Goel
> "Th
this is a single island, sorry for that
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Tue, Jan 10, 2012 at 9:24 AM, atul anand wrote:
> @Ashish Goel : didnt get it :(
>
>
> 1 1 0 0
> 1 1 0 0
> 0 0 1 1
>
>
> 1-1-1 diagonal is one island ...wher
@atul:
no..my approach was wrongwe have to check recursively...as sravan said
--
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
@Ramakant : i guess you shud include diagonal case also
for each arr[i][j]
if(arr[i][j]==1)
{
if (!(arr[i-1][j]==1 || arr[i][j-1]==1 || arr[i-1][j-1]))
count++;
}
On Tue, Jan 10, 2012 at 9:33 AM, Ramakant Sharma wrote:
> Scan the matrix row wise left to right
> for each arr[i][j]
Scan the matrix row wise left to right
for each arr[i][j]
if(arr[i][j]==1)
{
if (!(arr[i-1][j]==1||arr[i][j-1]==1))
count++;
}
///also chk for baundary values accordingly
1 1 0 0
1 1 0 0
0 0 1 1
i think it should work..
--
You received this message because you are subscribed to the Go
@sravanreddy001 : got it ..thanks :)
On Tue, Jan 10, 2012 at 9:33 AM, sravanreddy001 wrote:
> @atul: given a matrix just like above, (usually an image) the pixel values
> with similar can be searched for around the current pixel, and they all can
> be marked in one go,
>
> think of an algorithm,
@atul: given a matrix just like above, (usually an image) the pixel values
with similar can be searched for around the current pixel, and they all can
be marked in one go,
think of an algorithm, which does the following
1) when a one is replaced by '2' manually, then algorithm changes every '1'
@Ashish Goel : didnt get it :(
1 1 0 0
1 1 0 0
0 0 1 1
1-1-1 diagonal is one island ...where is another??
1 1 0 0
1 1 0 0
0 0 1 1
these 1 will be considered one island of 2 island.??
On Tue, Jan 10, 2012 at 7:36 AM, Ashish Goel wrote:
> row, col, diag all
>
> 1-1-1 is a single island :)
>
@sravanreddy001 : Pixel fill algorithm ..what is the exact name of that
algo ???
--
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 t
this is similar to the Pixel fill algorithm usually used in photo editing
softwares (photoshop or paint )
BFS would be best approach to start with ( and check 4-adjacent or
8-includeing diagonal elements for a '1' and include that to queue. When
the queue becomes empty, increase the count by 1.
row, col, diag all
1-1-1 is a single island :)
1 1 0 0
1 1 0 0
0 0 1 1
this has only 2 islands
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
+919985813081
+919966006652
On Tue, Jan 10, 2012 at 7:29 AM, Ankur Garg wrote:
> Can you give an example
>
> Say matrix is
>
>
Can you give an example
Say matrix is
1 1 0 0
1 1 0 0
0 0 1 1
Has it got 3 islands i.e 1-1 be in same row or they can be column wise also
i.e. 5
On Tue, Jan 10, 2012 at 7:09 AM, Ashish Goel wrote:
> there is a matrix of 1 and 0
> 1 is a island and 0 is water
> 1-1 together makes one island
there is a matrix of 1 and 0
1 is a island and 0 is water
1-1 together makes one island
calculate total no of islands
Best Regards
Ashish Goel
"Think positive and find fuel in failure"
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post
if element is 0 in matrix then entire row and column should be set to 0
i got this from sumwhr
void makeRowColZero(int (*a)[COL])
{
int i, j, k;
k = 0;
for(i = 0; i < ROW; i++)
for(j = k; j < COL; j++)
{
if(0 == a[i][
hey from which college r u???
On Sun, Oct 2, 2011 at 10:51 PM, gaurav kumar wrote:
> there were 10 objective questions covering c,c++ and ds
> questions were on mainly memory allocation
> stack and heap ,etc
> output/error ;
>
> subjective part
> 1. compress the given string
> eg. aaabbcccaadee
there were 10 objective questions covering c,c++ and ds
questions were on mainly memory allocation
stack and heap ,etc
output/error ;
subjective part
1. compress the given string
eg. aaabbcccaadee
o/p = a3b2c3de2
2. u have to give the various test case and fault cases for a USB
device
such that
convert bst to doubly linked list inorder and find middle element using slow
and fast pointer concept
On Tue, Sep 27, 2011 at 2:18 PM, Ankur Garg wrote:
> I was thinking of making the tree balanced with equal no of nodes in left
> and right subtree
>
> Median will be root in this case
>
int bstMedian(node *root, int n, int &x)
{
if (node->left) return bstMedian(root->left, n, x);
x++;
if (x == n/2) return node->val;
if (node->right) return bstMedian(root->right, n, x);
}
call bstMedian(root, n, 0);
--
You received this message because you are subscribed to the Go
keep a global pointer and a global variable "check=0"
do inorder traversal..instead of printing the value do
if(check==0)
save pointer
check==1
else
check==0;
correct me if m wrong
On Tue, Sep 27, 2011 at 2:22 PM, anshu mishra wrote:
> do the inorder traversal as s
@Anshu
Will u be using extra space to store ur nodes in traversal ?
On Tue, Sep 27, 2011 at 2:22 PM, anshu mishra wrote:
> do the inorder traversal as soon as reached at n/2th element that will be
> median.
>
> --
> You received this message because you are subscribed to the Google Groups
> "
do the inorder traversal as soon as reached at n/2th element that will be
median.
--
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
I was thinking of making the tree balanced with equal no of nodes in left
and right subtree
Median will be root in this case
Regards
Ankur
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googl
Saw this question in one of the algo communities.
Amazon telephonic interview question on Matrix
Input is a matrix of size n x m of 0's and 1's. eg:
1 0 0 1
0 0 1 0
0 0 0 0
If a location has 1; make all the elements of that row and column = 1. eg
1 1 1 1
1 1 1 1
1 0 1 1
Solution should be with T
hi!! MS-IT is visiting our college. could anyone plz help me in knowing what
kind of questions(interview) they asked/asking.
Thanks in advance.
Ankit Arun
NIT Durgapur
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To view this discussio
What should be the answer to above questions...?
On Sat, Sep 17, 2011 at 5:01 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:
> Memory management has following things..
> 1.Relocation
> To maintain the free pages and when a page is to be swapped, we have to add
> that page into free
Memory management has following things..
1.Relocation
To maintain the free pages and when a page is to be swapped, we have to add
that page into free page list ..
For this ,if we maintain a bool array which is equal to # pages in RAM,it
gives whether it is free or not ..
2.Protection
If ours is st
13. Propose an algo/data struct for memory manager.
14. Propose and algo/data struct for timer manager.
--
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
thanx...it was very helpful :)
On Mon, Sep 12, 2011 at 8:46 PM, Piyush Grover wrote:
> A can remain same in following cases:
> -> If m, n are equal in all the N iterations
> -> if m, n are equal in N-2 iterations but in 1 iteration m and n both are
> different in that case there should be one ite
+1
On Mon, Sep 12, 2011 at 3:42 PM, pg@manit wrote:
> Cud some 1 suggest me 4m how 2 practise test cases type of questions
> which usually cum in MS written Papers?
> thanx..in advance
>
>
> Regards,
> PAYAL GUPTA
>
> --
> You received this message because you are subscribed to the Google Groups
If the application is deployed as a web application, then the server
response time depends on internet speed and therefore have to account that
exception.Anything more?
On Tue, Sep 13, 2011 at 10:37 AM, bharatkumar bagana <
bagana.bharatku...@gmail.com> wrote:
> ya from the 2nd quest, we can
ya from the 2nd quest, we can infer some more ... like the way we
represent the date of birth is different than other countries...PIN code,6
digits in INDIA, but may not be same in other countries ...
On Mon, Sep 12, 2011 at 7:06 PM, teja bala wrote:
> 1-Write test cases for a new student reg
A can remain same in following cases:
-> If m, n are equal in all the N iterations
-> if m, n are equal in N-2 iterations but in 1 iteration m and n both are
different in that case there should be one iteration where m and n should be
same as the previous
iteration so that they are swapped again to
@piyush..
cud u plzz..xplain...n elaborate
Regards,
Payal Gupta
On Mon, Sep 12, 2011 at 10:15 PM, Piyush Grover
wrote:
> Sry i was little wrong:
>
> nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn*2^(n/2)*(1/n)^n
> when n is even
>
> nC0*(1/n)^n + nC2 *2*(1/n)^n +
> nC4*2^2*(1/n)^n+
Sry i was little wrong:
nC0*(1/n)^n + nC2 *2*(1/n)^n + nC4*2^2*(1/n)^n++nCn*2^(n/2)*(1/n)^n
when n is even
nC0*(1/n)^n + nC2 *2*(1/n)^n +
nC4*2^2*(1/n)^n++nCn-1*2^(n-1/2)*(1/n)^n when n is odd
On Mon, Sep 12, 2011 at 10:08 PM, Piyush Grover
wrote:
> it should be:
>
> (1/n)^n * (1 + 2
it should be:
(1/n)^n * (1 + 2 + 2^2 + 2^3 +(n/2)+1 terms) = {2^(1 + n/2) - 1}*(1/n)^n
when n even
(1/n)^n * (1 + 2 + 2^2 + 2^3 +(n-1/2)+1 terms) = {2^(1 + (n-1)/2) -
1}*(1/n)^n when n is odd
-Piyush
On Mon, Sep 12, 2011 at 8:01 PM, sandeep nagamalli wrote:
> I think it is 1 / (2
Cud some 1 suggest me 4m how 2 practise test cases type of questions
which usually cum in MS written Papers?
thanx..in advance
Regards,
PAYAL GUPTA
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogee
I think it is 1 / (2N)
(1/N) * (1/N)*(N/2) = 1/(2N)
On Mon, Sep 12, 2011 at 6:33 PM, Akash Mukherjee wrote:
> this is a case, but isnt der a case of circular permutation 2??
> what say abt dis
> 0,1
> 2,3
> 4,5
> 0,1
> 2,3
> 4,5
>
> it wrks i gues??
>
>
> On Mon, Sep 12, 2011 at 12:56 PM, teja
1-Write test cases for a new student registration form. The
registration form captures Student name, email address, Address, Date
of birth, Password. It also asks the student to confirm the password.
2-Consider that this application is being deployed as Web application
and Desktop application and
this is a case, but isnt der a case of circular permutation 2??
what say abt dis
0,1
2,3
4,5
0,1
2,3
4,5
it wrks i gues??
On Mon, Sep 12, 2011 at 12:56 PM, teja bala wrote:
>
>
> I think it is 1/N
>
> let N=6 that means rand(6)= takes values 0-5 i.e 6 values.
> rand(m)=6 values
> rand(n)=6 value
I think it is 1/N
let N=6 that means rand(6)= takes values 0-5 i.e 6 values.
rand(m)=6 values
rand(n)=6 values
total combinations 6*6=36 values set but among dem array will change only
for
(0,0)(1,1)(2,2)(3,3)(4,4)(5,5)(6,6)=6values of N
So 6/36=1/6
If we generalize it 1/N
correct me if i'm wro
given a rand(N) a random generator 0 - N-1.
now
//assume N is defined somewhere
int A[N]
for(i = 0; i < N; i++){
int m = rand(N);
int n = rand(N);
swap(A[m],A[n]);
}
what is the probability that array A remains the same?
p.s. rand n swap are o(1) in case it makes any diff
--
You received this m
which is the best site where in can find backtracking and branch and bound
programs ?
On Wed, Sep 7, 2011 at 8:58 PM, gmagog...@gmail.com wrote:
> 0xa == 0x 1010, which stands for all the even bits
> 0x5 == 0x 0101, which stands for all the odd bits
>
> >>1 and <<1 means shifting odd to even and
0xa == 0x 1010, which stands for all the even bits
0x5 == 0x 0101, which stands for all the odd bits
>>1 and <<1 means shifting odd to even and even to odd
then | means putting new even bits and odd bits together
Yanan Cao
On Wed, Sep 7, 2011 at 10:23 AM, teja bala wrote:
>
> Can anyone plzz
Can anyone plzz xplain the code?
public static int swapOddEvenBits(int x) {
return ( ((x & 0x) >> 1) | ((x & 0x) << 1) );
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@goo
haha lol f o
On Tue, Sep 6, 2011 at 8:51 AM, Yogesh Yadav wrote:
> @all :
> Thanks for correcting me.
>
>
> On Tue, Sep 6, 2011 at 3:41 AM, Piyush Grover
> wrote:
>
>> Here's the pseudo code. I hope it should work.
>>
>>
>> d = (d[0]d[1])
>> m = (m[0]m[1])
>> y = (y[0]y[1]y[2]y[3])
>> dd =
@all :
Thanks for correcting me.
On Tue, Sep 6, 2011 at 3:41 AM, Piyush Grover wrote:
> Here's the pseudo code. I hope it should work.
>
>
> d = (d[0]d[1])
> m = (m[0]m[1])
> y = (y[0]y[1]y[2]y[3])
> dd = d;
> mm = m;
> yy = y;
>
> while(1){
> if (strcmp(concat(dd,mm), reverse(yy))
>
Here's the pseudo code. I hope it should work.
d = (d[0]d[1])
m = (m[0]m[1])
y = (y[0]y[1]y[2]y[3])
dd = d;
mm = m;
yy = y;
while(1){
if (strcmp(concat(dd,mm), reverse(yy))
return(dd,mm,yy)
else if(isValidDateMonth(yy[3]yy[2], yy[1]yy[0] ,yy){
if(yy[3]yy[2] > d && yy[1]
@yogesh:
u r incrementing num1 and decrementing num2 without considering there are 12
months and 30/31 days
On Tue, Sep 6, 2011 at 12:07 AM, Neha Singh wrote:
> @piyush :
> 01/02/2011
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
>
@piyush :
01/02/2011
--
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, vis
One thing i would like to know is
01/02/2011 needs to be considered or 1/02/2011.
thnx
On Mon, Sep 5, 2011 at 11:48 PM, Neha Singh wrote:
> @yogesh: its stiil not correct. There r many test cases where ur solution
> will fail
>
> --
> You received this message because you are subscribed to the
@yogesh: its stiil not correct. There r many test cases where ur solution
will fail
--
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
not correct.
On Mon, Sep 5, 2011 at 11:01 PM, Yogesh Yadav wrote:
> //Num is our given number obtained from date
>
> 1.divide num into 2 parts last 4 and first 4
> ex: num=96548765
> num1=9765,num2=Reverse(8765)
> 2.if(num1>num2)
>add(num1-num2) in num2
> 3. num3=reverse(num2)
>
hmmm ok thanks for correcting me :)
On Mon, Sep 5, 2011 at 11:01 PM, Yogesh Yadav wrote:
> //Num is our given number obtained from date
>
> 1.divide num into 2 parts last 4 and first 4
> ex: num=96548765
> num1=9765,num2=Reverse(8765)
> 2.if(num1>num2)
>add(num1-num2) in num2
> 3.
balls to u guys !!
On Mon, Sep 5, 2011 at 11:01 PM, Yogesh Yadav wrote:
> //Num is our given number obtained from date
>
> 1.divide num into 2 parts last 4 and first 4
> ex: num=96548765
> num1=9765,num2=Reverse(8765)
> 2.if(num1>num2)
>add(num1-num2) in num2
> 3. num3=reverse(
101 - 200 of 459 matches
Mail list logo