are the sizes of the two arrays same??
On 7/19/11, swetha rahul swetharahu...@gmail.com wrote:
Hi,
Find the kth smallest element in O(logk) given 2 sorted arrays.
Merging the arrays is not allowed. I can do it in O(k).. How to do in
O(logk)..
--
You received this message
Arrays are not of the same size
On Tue, Jul 19, 2011 at 10:41 PM, Rishabh Maurya poofiefoo...@gmail.comwrote:
Its solvable using Binary Search , offcourse not in log(k) but in log(sum
of size of array).
--
You received this message because you are subscribed to the Google Groups
Given an infinite stream of bits with bits being appended at the
highest significant position. Give an algorithm to say whether the
number formed by sequence of bits that had been processed till then ,
is divisible by 3 or not ?
My sol:
have a variable sum...find the sum of bitswhenever
use automata theory. draw dfa for divisibility by 3..
On Tue, Jul 19, 2011 at 11:23 PM, siva viknesh sivavikne...@gmail.comwrote:
Given an infinite stream of bits with bits being appended at the
highest significant position. Give an algorithm to say whether the
number formed by sequence of
Divisibility of 3 of numbers in base 2 can be seen same as
divisibility of numbers by 11 in base 10...
maintain two variable even_sum odd_sum, both initialized to 0
when an odd location in the number is set increment odd_sum
when an even location in the number is set increment even_sum
Better go through following link , its explained nicely their.
http://www.ihas1337code.com/2011/01/find-k-th-smallest-element-in-union-of.html
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
i found an algo in log(k) but necessary condition is that k must be less
than both the size of arrays...
now it works like that
we will find using binary search applying on both the arrays
assume both the arrays upto k-1 positions only because the number lies in
between only
now consider two
The above method is good , I was going to suggest another algo it
takes the same complexity but lengthy so I am not posting my algo...
On 7/19/11, Piyush Sinha ecstasy.piy...@gmail.com wrote:
Divisibility of 3 of numbers in base 2 can be seen same as
divisibility of numbers by 11 in base 10...
Can any one please suggest the type of Microsoft written test. How many
sections are there? What are the area they mainly focus on?
In which language do I need to code? My experience is in Java. And never
worked in c/c++.Should I face any difficulties??
Are there any OS , compiler , digital
Implement a C++ garbage collector efficiently..any ideas ???
..shud we need to do something with destructor???
--
Regards,
$iva
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
no I don't think they ask for a specific language .they will emphasis
on algo,DS,puzzle,sql some networking
On 7/18/11, sourabh chaki sourabh.chak...@gmail.com wrote:
Can any one please suggest the type of Microsoft written test. How many
sections are there? What are the area they mainly
Reversing linked list works.. A followup question will be without using the
reversal...For that we should first traverse the longest linked list such a
way that it's remaining length is equal to other linked list and multiply
using recursion.. After that based on carry.. you should repeat again
Offcourse destructor is needed or smart pointer will do for dynamic
memory allocation.local variable r stored in stack it is been handled
in run time .
On 7/18/11, sivaviknesh s sivavikne...@gmail.com wrote:
Implement a C++ garbage collector efficiently..any ideas ???
..shud we need
Use smart pointers from boost library.
On Mon, Jul 18, 2011 at 10:24 PM, sivaviknesh s sivavikne...@gmail.comwrote:
Implement a C++ garbage collector efficiently..any ideas ???
..shud we need to do something with destructor???
--
Regards,
$iva
--
You received this message
convert a number in base 5 to base 9
--
Regards,
$iva
--
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
1st convert base 5 to base 10 and then base 10 to base 9
On Mon, Jul 18, 2011 at 11:54 PM, sivaviknesh s sivavikne...@gmail.comwrote:
convert a number in base 5 to base 9
--
Regards,
$iva
--
You received this message because you are subscribed to the Google Groups
Algorithm
is there any direct conversion possible like from 2 to 16 ??
On Mon, Jul 18, 2011 at 11:56 PM, Nishant Mittal mittal.nishan...@gmail.com
wrote:
1st convert base 5 to base 10 and then base 10 to base 9
On Mon, Jul 18, 2011 at 11:54 PM, sivaviknesh s sivavikne...@gmail.comwrote:
convert a
Use logarithms and the properties that follow.
Let the number be n
Find log to the base 5 of n =*X*= *log*(n)/*log*(5) here *log* refers to
base 10
Find log to the base 9 = *X*/(log to the base 5 of 9)
Done!
On 18 July 2011 23:58, varun pahwa varunpahwa2...@gmail.com wrote:
is there any direct
we can use auto_ptr class defined in std to implement garbage collector.. by
using reference count method
On Mon, Jul 18, 2011 at 10:45 PM, Vivek Srivastava
srivastava.vivek1...@gmail.com wrote:
Use smart pointers from boost library.
On Mon, Jul 18, 2011 at 10:24 PM, sivaviknesh s
1.while typing it must show most popular searches starting from the string
which we have typed so far
2.it must show most popular websites first
3.it must show related searches
there can be many more
On Sun, Jul 17, 2011 at 8:05 PM, swetha rahul swetharahu...@gmail.comwrote:
Write
1. If u entered nothing and just pressed search, it should display nothing.
2. If u just entered a space and just pressed search, it should display nothing.
3.Verify the results are really related to give word or not
4.Check if proper Result is displayed for key word.
5. Check for the Order of the
ya got it..thanks...
how abt test cases for program to check whether a given string is palindrome
or not..?
On Sun, Jul 17, 2011 at 8:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
1. If u entered nothing and just pressed search, it should display nothing.
2. If u just entered a space and
Hi,
Given 2 linked lists L1 and L2 create a linked list that gives
the multiplication of the above 2 linked lists.
Eg: L1 =1-5
L2 =1-0
Ans must be 1-5-0
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
p=L1
q=L2
while(p!=NULL q!=NULL)
{int r;
r-=p-info*q-info;
p=p-next;
q=q-next;
insert(L3,r);
}
insert is the normal insert operation of linked list
On Mon, Jul 18, 2011 at 1:15 AM, swetha rahul swetharahu...@gmail.comwrote:
Hi,
Given 2 linked lists L1 and L2 create a linked list
aditi : problem your code
1 .you are not putting single digit in third list but whole
multiplication of two digit
2. forward add carry to next result ;
3. keep mind that list size may not be equal
4. list is singly so start processing from right side you need reverse them
--
You received this
@Hary i dint understand wat do u mean by saying list is sinle so strt
processing from rightcan u gv an example with the list containing more
than 1 node and show me wat wud be the output
On Mon, Jul 18, 2011 at 2:13 AM, hary rathor harry.rat...@gmail.com wrote:
aditi : problem your code
1
int means
1-5-6-7
2-7-9
means you will multiply 7*9 result 9 insert in 3rd list
so start from end of list not from start
now do you under stand
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
r v not supposed to actually mutiply?? 7*9 y shud v place 9 in the third
list??
On Mon, Jul 18, 2011 at 2:25 AM, hary rathor harry.rat...@gmail.com wrote:
int means
1-5-6-7
2-7-9
means you will multiply 7*9 result 9 insert in 3rd list
so start from end of list not from start
now
sorry 7*9=63
put 3 in list 3
--
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
and 6 is carry forwarded???
next node wud be 6*7=42+6=48
8 and 4 carry?
On Mon, Jul 18, 2011 at 2:28 AM, hary rathor harry.rat...@gmail.com wrote:
sorry 7*9=63
put 3 in list 3
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
check my code below...it works for all cases
*
**node *MUL(node *h1,node *h2)
{
node *h3,*p,*r;
h1 = reverse(h1);
h2 = reverse(h2);
h3 = multiply(h1,h2-data);
h2 = h2-next;
p = h3;
while(h2)
{
r = multiply(h1,h2-data);
p-next
Hi,
#includestdio.h
char *c[]={ENTNG,NST,AMAZI,FIRBE};
char **cp[]={c+3,c+2,c+1,c};
char ***cpp=cp;
void main()
{
printf(%s,**++cpp);
printf(%s,*--*++cpp+3);
printf(%s,*cpp[-2]+3);
printf(%s,cpp[-1][-1]+1);
}
The answer is AMAZING BEST ... Can somebody explain the last printf
alone.??
--
last printf
*(*(cpp-1)-1)+3
gives =ST
second last printf
*(*(cpp-2)) +3 give BE
On Fri, Jul 15, 2011 at 10:45 PM, swetha rahul swetharahu...@gmail.comwrote:
Hi,
#includestdio.h
char *c[]={ENTNG,NST,AMAZI,FIRBE};
char **cp[]={c+3,c+2,c+1,c};
char ***cpp=cp;
void main()
{
after third printf cpp points to c+1 then c[-1][-1] let it point to
c+2+(-1) which is c+1 .. next its easy just add one to the string pointed
out ..!!
On Fri, Jul 15, 2011 at 10:45 PM, swetha rahul swetharahu...@gmail.comwrote:
Hi,
#includestdio.h
char *c[]={ENTNG,NST,AMAZI,FIRBE};
char
its failing for 9*12 with n=7, if i take max square considered of hcf(9,12),
left space is 6*6 and 3*3.
i'll have more left space than what i consider three 4*4 squares, four 1*1
squares. leftspace is 1*5.
i think needs different trick
surender
On Mon, Jul 11, 2011 at 9:59 PM, Yogesh Yadav
Given a very big file of words, a word in each line, sort the words .
Please provide the algorithm and explanation .
--
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
Algorithm along with code is explained very well in KR refer page 108;)
On Wed, Jul 13, 2011 at 10:26 AM, rShetty rajeevr...@gmail.com wrote:
Given a very big file of words, a word in each line, sort the words .
Please provide the algorithm and explanation .
--
You received this message
maintain a key.Associate with each word a key.When comparing the string,if
string1string2 swap the keys instead of the words.Saves enormous time.
On Wed, Jul 13, 2011 at 10:32 AM, nicks crazy.logic.k...@gmail.com wrote:
Algorithm along with code is explained very well in KR refer page 108
;)
you can sort it using external merge sort. if ur file is greater than memory
refer henry F. korth Database System Concept
On Wed, Jul 13, 2011 at 10:26 AM, rShetty rajeevr...@gmail.com wrote:
Given a very big file of words, a word in each line, sort the words .
Please provide the algorithm and
Given a BST and integer value K. Find all pairs of nodes (x,y), such that
x-data + y-data = K
Time O(n)
Can someone provide a pseudocode/code to solve this using the concept of
inorder and reverse inorder traversal of BST?
PS: please don't post other solutions for this, I know this can be solved
If we dont want the tree back, we can convert the BST to DLL and do the
job..
On Mon, Jul 11, 2011 at 3:01 PM, aanchal goyal goyal.aanch...@gmail.comwrote:
Given a BST and integer value K. Find all pairs of nodes (x,y), such that
x-data + y-data = K
Time O(n)
Can someone provide a
we should not deform the tree.
- converting into dll and solving.
- doing inorder and hashing
- doing inorder and saving in array
All above solutions I know, so dont post them,
i dont know how to solve this using inorder and reverse inorder approach..
On Mon, Jul 11, 2011 at 3:13 PM, Piyush Sinha
Ok lets see.
1-Traverse a pointer right down to the leftmost element,i.e.the
shortest,say small
2-traverse a pointer left down to the rightmost element i.e.the largest.say
large
while(small!=large)
3-Compare their sum.If sumk set large to its successor in reverse
inorder.(I am not sure if u meant
We need all pairs.
Best Regards,
T V Thirumala Reddy
On Mon, Jul 11, 2011 at 3:56 PM, saurabh singh saurab...@gmail.com wrote:
Ok lets see.
1-Traverse a pointer right down to the leftmost element,i.e.the
shortest,say small
2-traverse a pointer left down to the rightmost element i.e.the
what is the complexity of your alg?
Best Regards,
T V Thirumala Reddy
On Mon, Jul 11, 2011 at 4:02 PM, TIRU REDDY tiru...@gmail.com wrote:
We need all pairs.
Best Regards,
T V Thirumala Reddy
On Mon, Jul 11, 2011 at 3:56 PM, saurabh singh saurab...@gmail.comwrote:
Ok lets see.
Finding the smallest node-o(logn)
Finding the largest node-o(logn)
Finding the Successor.(o(1) (depends if u have the parent pointer in the
tree implementation))
worst case traversal-o(n)
COmplexity o(logn)+o(logn)+o(n*1)=o(n)
correct me if I am wrong.I was never good with calculating complexity,
@saurabh:
finding succesor may not be O(1)... it can be O(logn)
--
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
@AanchalI think my following algo will work..its a modification of
Morris traversal...check if you can find any bug in it...I have tried my
best to make it error free..For further details regarding Morris traversal,
check out http://geeksforgeeks.org/?p=6358
*void findsum(node *T,int key)
{
@Piyush..
I tried your algo on BST {5,4,6,3,2,1,8,7,10,12,9,11}.
Its only returning 1+7.
Other pairs are 5+3, 6+2.
On Mon, Jul 11, 2011 at 6:56 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
@AanchalI think my following algo will work..its a modification of
Morris traversal...check if you
@Anchalthanks for pointing out the error...i found where the error
is...it is the else loop in this line in this checking...
if(p1-right == cur1 || p2-left == cur2)
actually before i have already assigned p1-right == cur1 (or
p2-left=cur2)..it shud have been in else loop..soryy for the
Check this one once..I hope it will work now..I hv introduced two more
variables check1 and check2
*
void findsum(node *T,int key)
{
int n = countnodes(T);//returns the number of nodes in the BST
int i=0;
int j=n-1;
node *cur1,*cur2,*p1,*p2;
cur1=cur2=T;
int
largest size of square would be = H.C.F of width and height .
now with size known we have to just arrange squares
this can be done such that we can make a big square by adding them...
for ex 1st square can be made by just (1 square)
2nd square can be made by adding 3 sqaures around it
largest size of square would be = H.C.F of width and height .
now with size known we have to just arrange squares
this can be done such that we can make a big square by adding them...
for ex 1st square can be made by just (1 square)
2nd square can be made by adding 3 sqaures around it
Given a rectangle with known width and height, design an algorithms to fill
the rectangle using n squares(n is integer, also given) and make sure in the
result the wasting area is minimized. Length of square doesn't have to be
integer.
I.e, given width=3,height=2,n=5, one solution is that
wastage can be minimized if side of square is maximized.
so largest size of square would be = H.C.F of width and height .
and also number of squares needed will be = (width*height)/side^2 .
On Sun, Jul 10, 2011 at 9:11 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
Given a rectangle with
@vaibhav this fails as n will be provided in the question.
On Sun, Jul 10, 2011 at 9:56 PM, vaibhav shukla vaibhav200...@gmail.comwrote:
wastage can be minimized if side of square is maximized.
so largest size of square would be = H.C.F of width and height .
and also number of squares needed
with n=(height*width)/side^2 .. u can calculate the side if n would be
given.
On Sun, Jul 10, 2011 at 10:37 PM, vaibhav agarwal
vibhu.bitspil...@gmail.com wrote:
@vaibhav this fails as n will be provided in the question.
On Sun, Jul 10, 2011 at 9:56 PM, vaibhav shukla
@above..
thanks man!! got it now..
Regards,
Priyanshu Gupta
On Wed, Jul 6, 2011 at 11:13 PM, pacific :-) pacific4...@gmail.com wrote:
Hi,
You may look out for plagirism detectors.
My approach would be :
1. Hash all the keywords in one file and keep the count.
2. For each keyword in the
Hi,
You may look out for plagirism detectors.
My approach would be :
1. Hash all the keywords in one file and keep the count.
2. For each keyword in the other file , check if it exists in the hash table
, decrement its count. Also increment a counter which represents the
similarity between the
things to consider
1. priority(static, dynamic(based on wait and usage time), priority
boost)
2. busy hrs vrs non-busy hrs stop time
3. when idle, should stop at highest traffic generation floor
4. weight factor to decide if to stop or not
5. multiple elevators, some for lower
See diff documentation. It's an application of Longest Common
Subsequence problem.
http://en.wikipedia.org/wiki/Diff
On Wed, Jul 6, 2011 at 11:12 AM, priyanshu priyanshuro...@gmail.com wrote:
What is the most efficient way to compare two text documents?? Also we
need to find the percentage by
Hi,
Write a function which takes two char * s as inputs, one is a
regular expression pattern and the other is a test string and check whether
the test string is of the given regular expression pattern.
The regular expression pattern can contain all lower-case letter, asterisk
and
Can we do it using suffix trees and apply DFS on it??
On Tue, Jul 5, 2011 at 11:45 PM, swetha rahul swetharahu...@gmail.comwrote:
Hi,
Write a function which takes two char * s as inputs, one is a
regular expression pattern and the other is a test string and check whether
the
just thinking aloud..
find substrings connected by ? like b,c, ensure that b?c is found, if not
return false
if found find 'a' like prefix in earlier part of the string..
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Wed, Jul 6, 2011 at 12:02
What is the most efficient way to compare two text documents?? Also we
need to find the percentage by which they match..
Thanks,
priyanshu
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
WAP to sort an array of character strings on the basis of last
character of each string
eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
reverse all strings and then sort.
On Mon, Jun 27, 2011 at 2:28 PM, Nishant Mittal
mittal.nishan...@gmail.comwrote:
WAP to sort an array of character strings on the basis of last
character of each string
eg:- {xxxc , yyya, zzzb} = {yyya , zzzb, xxxc}
--
You received this message because
you are given a system of passing binary trees among 2 ppl
Step1: convert the tree to preorder and inorder strings
Step2:send those strings to the intended person
Step3:get back tree from the strings
whats your strategy of testing?write various test scenarios.
--
You received this message
given string abcdefi
output string cbafedi
program is simple, write code and test this function
what if the given string is a book of 500 pages.
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
--
You received this
1 :take directly word by word direct from input stream
2: just reverse word and put them into out stream
Note : out stream can send data either on console or file
this is require temp string sizeof ( length of largest word) that
you calculate
On 6/24/11, Ashish Goel ashg...@gmail.com
Sukhmeet can you please explain your approach ?
On Fri, Jun 17, 2011 at 3:48 PM, sukhmeet singh sukhmeet2...@gmail.comwrote:
Can be done by any standard disk scheduling methods.. i guess
On Tue, Jun 14, 2011 at 2:01 PM, Akshata Sharma akshatasharm...@gmail.com
wrote:
Design an elevator
Can be done by any standard disk scheduling methods.. i guess
On Tue, Jun 14, 2011 at 2:01 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
Design an elevator system for a 100 story building. Address all issues,
like number of elevators, speed of each (Not numerically), waiting times
etc.
Given a character array with a set of characters, there might be repetitions
as well, given two characters, you should give the minimum distance between
these two characters in the whole array. O(n) solution is required.
--
Harshal Choudhary,
III Year B.Tech CSE,
NIT Surathkal, Karnataka, India.
Try this:
say i is the index of the first occurrence of the first character
say j is the index of the first occurrence of the second character
say n is length of array
int Min = n+1;
while(i n j n){
int Min = min(Min, abs(i-j))
if(i j){
find next occurrence of first character
}
else{
find
keep 4 pointers
la, lb ra, rb
la = -1; lb=-1; ra=n; rb=n;
l stands for left side, r stands for right side
a is first char b is second char
int minD( char []a, const int n, const char a1, const char b1)
int i=0;
int j=n-1;
int mind=-1;
while (ij)
{
bool chkMin = false;
if (a[i] == a1)
{
issue
axxbabxabaxxb
this solution will not work
rewriting, this should work...
int minD( char []a, const int n, const char a1, const char b1)
int i=0;
int j=n-1;
int mind=-1;
while (ij)
{
bool chkMin = false;
if (a[i] == a1)
{
la=i; chkMin = true;
// if ((la==-1) ||
will this work 4
axxbxba
chars r a,b in this str
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Fri, Jun 17, 2011 at 11:47 PM, sunny agrawal sunny816.i...@gmail.comwrote:
Try this:
say i is the index of the first occurrence of the first
Design an elevator system for a 100 story building. Address all issues, like
number of elevators, speed of each (Not numerically), waiting times etc.
There would be 100-200 people living/working on each floor. (You don't need
to discuss the traffic patterns.)
--
You received this message because
Question:
An array is of size N with integers between 0 and 1024(repetitions allowed).
Another array of integers is of size M with no constraints on the numbers.
Find which elements of first array are present in the second array. (If you
are using extra memory, think of minimizing that still,
A1.bitmap.
A2.xor.
On Thu, Jun 09, 2011 at 02:45:48AM -0700, Dumanshu wrote:
Q1. I have a file in which there are supposed to be 4 billion
numbers,
starting from 1 to 4,000,000,000 but unfortunately one number is
missing,
i.e there are only 3,999,999,999 numbers, I need to find the
I think RGGB is invalid as we have 4 different colors.
On Fri, Jun 10, 2011 at 10:10 AM, Harshal hc4...@gmail.com wrote:
#includeiostream
#includestring
using namespace std;
void mastermind(char* guess, char* sol, int *hits, int *pseudohits)
{
int temp[256] = {0};
int
On Thursday 09 June 2011 03:15 PM, Dumanshu wrote:
Q1. I have a file in which there are supposed to be 4 billion
numbers,
starting from 1 to 4,000,000,000 but unfortunately one number is
missing,
i.e there are only 3,999,999,999 numbers, I need to find the missing
number.
Is the array sorted?
For Q2 Bitwise X-OR operation of all input numbers does the trick.
--- On Thu, 9/6/11, Dumanshu duman...@gmail.com wrote:
From: Dumanshu duman...@gmail.com
Subject: [algogeeks] MS Interview
To: Algorithm Geeks algogeeks@googlegroups.com
Date: Thursday, 9 June, 2011, 9:45 AM
Q1. I have a file
On Thursday 09 June 2011 09:59 AM, Ershad K wrote:
On Thursday 09 June 2011 03:15 PM, Dumanshu wrote:
Q1. I have a file in which there are supposed to be 4 billion
numbers,
starting from 1 to 4,000,000,000 but unfortunately one number is
missing,
i.e there are only 3,999,999,999 numbers, I need
The answer to second question is simple. XORing all the elements
should do it for you.
On Thu, Jun 9, 2011 at 3:15 PM, Dumanshu duman...@gmail.com wrote:
Q1. I have a file in which there are supposed to be 4 billion
numbers,
starting from 1 to 4,000,000,000 but unfortunately one number is
2nd part can be done just take the xor of all the numbers same number xor
returns 0 so only seven will remain.
1st part can be done in O(n) because estimate sum - n*(n+1)/2. now sub from
estimated sum each array element. the last value remained is the missing
number.
correct me if i am wrong.
On
Q1. I have a file in which there are supposed to be 4 billion
numbers,
starting from 1 to 4,000,000,000 but unfortunately one number is
missing,
i.e there are only 3,999,999,999 numbers, I need to find the missing
number.
Q2. I have an array consisting of 2n+1 elements. n elements in it are
For 1.
sum the numbers in the file, subtract it from sum of first 4 billion
numbers.
On Thu, Jun 9, 2011 at 3:44 PM, Navneet Gupta navneetn...@gmail.com wrote:
The answer to second question is simple. XORing all the elements
should do it for you.
On Thu, Jun 9, 2011 at 3:15 PM, Dumanshu
I think numbers in question1 are in sequence (ascending order).
2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com
For 1.
sum the numbers in the file, subtract it from sum of first 4 billion
numbers.
On Thu, Jun 9, 2011 at 3:44 PM, Navneet Gupta navneetn...@gmail.comwrote:
The answer to
sum can overflow
Xor method can also be applied to Q1. no need of numbers to be sorted.
2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com
For 1.
sum the numbers in the file, subtract it from sum of first 4 billion
numbers.
On Thu, Jun 9, 2011 at 3:44 PM, Navneet Gupta
Sum wont overflow, ULL range will include sum.
On Thu, Jun 9, 2011 at 3:52 PM, sunny agrawal sunny816.i...@gmail.comwrote:
sum can overflow
Xor method can also be applied to Q1. no need of numbers to be sorted.
2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com
For 1.
sum the numbers in
yes, but using xor no need of ULL :)
2011/6/9 • » νιρυℓ « • vipulmehta.1...@gmail.com
Sum wont overflow, ULL range will include sum.
On Thu, Jun 9, 2011 at 3:52 PM, sunny agrawal sunny816.i...@gmail.comwrote:
sum can overflow
Xor method can also be applied to Q1. no need of numbers to
I this this code will solves it ...
*#include stdio.h
#include stdlib.h
struct node{
int val;
struct node *next;
};
int main(){
struct node *head = NULL , *next_ptr = head;
int n = 1;
while ( n = 6 ){
struct node *temp = (struct node*) malloc (sizeof(struct node)
Game of master mind: you have four balls, and four different colors, as a
solution. The user tries to guess the solution. If they guess the right
color for the right spot, it counts as a 'hit'. If it's the right color, but
the wrong spot, it counts as a psuedo-hit. For example: if the solution is
#includeiostream
#includestring
using namespace std;
void mastermind(char* guess, char* sol, int *hits, int *pseudohits)
{
int temp[256] = {0};
int len1=strlen(sol);
int len2=strlen(guess);
while(--len1+1)
(guess[len1]==sol[len1]) ? ((*hits)+=1,temp[len1] = 1) : (temp[sol[len1]]
+=
[ ] meas addtion is addition is base address so 3 +Ya!Hello! how is
this? %s\n
become Hello! how is this? %s\n cause of add 3 in base address in
followed string ;
this result as format specifier in printf funcution ; same as for second
perameter ;
5+junk/super become super string reson is
the area points , boundary on which circle need to display
and radius should not be negative
--
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,
@kunal patil: You are correct.
the double linked list doent solve the this problem.
--
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/-/NWtqQndBbExyV1lK.
To post
how about this one?
Node* reverseBy2(Node* head){
Node* p1 = head;
if(p1 == NULL)
return NULL;
Node* p2 = p1-next;
if(p2 == NULL)
return head;
Node* nextHead = p2-next;
p2-next = p1;
p1-next = reverseBy2(nextHead);
return p2;
}
[?]
2011/6/1 Shivaji
struct node *reverse(struct node *head, int k )
{
struct node *prev = NULL;
struct node *current = head;
struct node *next = NULL;
int count = 0;
while(current count k) {
next = current-next;
current-next = prev;
prev = current;
current = next;
count++;
}
/*** reverse remaining nodes
301 - 400 of 438 matches
Mail list logo