Hello All,
Can anyone forward a ebook from where frequently asked
Javascript and JQuery Questions are asked ? And from where we can get the
real problem which are faced in Javascript and JQuery in Projects??
Pls If anyone know any reference of ebook plz send me ...
Thanks,
Does any1 working in OSG have some idea of how to get the PRIMITIVE
information from given 3D model which ..
My objective is to get the primitives of the 3D model and after getting the
vertices of all the primitives , I will create the Polytope from these
vertices for finding the
Suppose you are given some convex polygon . Now suppose you want to
divide the polygon area into a number of grids . And I want to find
the points after we have divided the polygon .
For simplicity u can consider convex polygon , don't take into account
concave or self intersecting polygon .
No it's not if u use the AP series mathematical formula n(n+1)/2..
Then it will be of O(n).
--
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
Given an array A[] and a integer num(K) . Need to find the combination
of four no's in the array whose sum is equal to num(K).
--
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
HAPPY NEW YEAR to all Geeks !!!
Given an array of size N and a integer Num(K) . Need to find the
combination of four no's in the array whose sum is equal to Num(K).
Needed a solution whose complexity is less than O(n^3) .
--
You received this message because you are subscribed to the Google
I found something similar algorithm . one hich DFS and BFS
algorithm :- one named Trémaux's algorithm uses DFS
and for finding the shortest path it used Shortest path algorithm .
Follow the link and find the these algorithms here ..
http://en.wikipedia.org/wiki/Maze_solving_algorithm
--
You
@Sid small Modification in ur code in 3rd line it should be float ans
= log(n)/log(i); instead of float ans = log(n)/log(2);
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
I think u hav misunderstood my logic .
I told What comes to my mind is to get all PRIME FACTORS from 2 to
SQRT(N) [Prime Sieve] , Here N is the Given Integer .
So I wrote the code and let me know if there is any problem :-
#includecstdio
#includeiostream
#includecmath
using namespace
Continued:--
Sry , I misunderstood the problm I thought it to be the power of Prime
factor ...
For finding the required answer of N can be done N = a^p b^q
Need to find the hcf of (p,q,...) 1 then the number can be
expressed as m^n ..
--
You received this message because you are
Yess I agree. The post very often comes out of sync giving rise to
confusion . And also it get difficult to follow up with the
continuation of the previous post .
Atleast the post should be queued in the order it is coming and after
validating the post , it can be posted in the same order as
I know tht it need GCD(a,b,) where N = p^a q^b...
I wrote it previously ... it's just tht my lates reply is not in
sequence . I hav added tht later ..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Have a look at this algo :- Steinhaus–Johnson–Trotter algorithm .
--
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
From Wht I can understand from problm to check whether N can be
expressed a m^n : Eg: 1331=11^3
What comes to my mind is to get all prime factors from 2 to SQRT(N)
[Prime Sieve] , Here N is the Given Integer .
Now Iterate over the prime number(p) from 2 to Sqrt(N)
do
T=N;
if(!(T%p))
Yes Quadratic approach will be naive . I thought initially to take the
input from the Liveware , and do the below :-
And we will computer for the number of unique number possible for 1
digit , Let the number of possible distinct permutation be X . And if
X = K , then we can generate the single
This can be done using Stack .
For example :- you have got the pattern :-
0 1 2 3 4 5 6 7 8 9 10 11
( ( ) ( ( ) ( ( ) ) ( ) ... this pattern is wrong the faulty index
is at index 3 .
void MatchingBracket( char *str )
{
while ( str[i++] != '\0' )
{
if ( str[i] == '(') push(i); // If
Continued .
Forgot to metion to also keep track of the index of the Closing first
bracket ( If tht closing doesn't hav matching opening bracket on it's
left ) and at last check for the top of the stack(If present) and the
index(if present) . And print the minimum index value of the
You are given a list of points in the plane, write a program that
outputs each point along with the three other points that are closest
to it. These three points ordered by distance.
The order is less then O(n^2) .
For example, given a set of points where each line is of the form: ID
x-coordinate
@Atul---
Read the Comment carefully .
I told :-
For finding the triplet we need to have a equation of the form :
f(x) ^3 + af(x)^2 + b f(x) . need to to find the cofficient of a
and b where f(x) is the polynomial formed from the elements in the
given set. This method will suffice the time
I think this question is discussed previously for Serialization U can
go through it :-
https://groups.google.com/group/algogeeks/browse_thread/thread/d95e792fbe1bfce0/4b7b12dc26ab2a5d?hl=enlnk=gstq=serialization#4b7b12dc26ab2a5d
--
You received this message because you are subscribed to the
I am giving the link I found useful :-
http://www.cs.iastate.edu/~cs577/handouts/polymultiply.pdf
There are many other good links , try to google it .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
How about using a Tournament tree . As the size of the size of huge we
heap is better option to opt for , which is also been implemented in
Tournament tree , and when the same element come more than once just
increment the count for the Frequency of the Internal Node . The
leaves will contain
Hi ,
As u can c tht test cases are huge,so we cann't go abt doing it by
repeatative sum , I think it can be done using prime seive and Euler
Toutient function ..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
You will not be able to get the correct solution with this algo becoz
ur algo will not able to generate all the 3 triplets sum.
You hav to loop through all the triplets ...
take for example the numbers :-
1 2 3 5 6..
Ur algo will generate the following triplet sum as
9 10 12 8 6 11 13 10 14
@All ,
The problm can be solved by Fast Fourier Transform .
The Concept used here is to Convert the number in the array into a
vector and Then apply multiplication using FFT . The below example
will clear it .
I will start will finding Pair of all Number equal to every possible
combination
Heey dude !!
He has given the link tht show the way how to find the sum from a
distinct , you need to manipulate the algorithm .
Below is the modified code .
#includeiostream
#includecstdio
#includecstdlib
using namespace std;
int N[40001]={0};
int compare(const void *a,const void *b)
{
You hav to find a an alternate recursive solution for finding the path
tht will reduce the function .
There is a solution available in the net google it . Google it
From there on it can get the code size reduced less thn 120
characters. I have got accepted by 112 characters .
--
You received
Given a number u have to check whether the number(N) can be expressed
in the form 3^n = N i:e It can be expressed in terms of power of 3.
It can be done taking log on both but I am looking an alternate
approach (bit manipulation) .
--
You received this message because you are subscribed to
Given a Natural Number N , We hav to check whether it can be expressed
in the form of 3^n =N . (0=nN)
It can be done taking log , but i m looking for some Bit
manipulation .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
Given a (Directed/Non Directed) graph and a source node and
destination node . Now your task is to find all the paths from a
source node to the destination node . Both for directed and non
directed graph.
--
You received this message because you are subscribed to the Google Groups
Algorithm
Topology Sort :-
Just want to share something to u all .
The field's where Topology sort is used :-
• Email loops.
• Compilation units.
• Class inheritance.
• Course prerequisites.
• Deadlocking detection.
• Precedence scheduling.
• Temporal dependencies.
• Pipeline of computing jobs.
• Check
As we all know that the new and delete operator , they are inherited
and tell call constructor and destructor respectively . Now Suppose I
have One Integer variable for the base class and one more Integer
variable for the derived class . So if I create some objects of
derived class it should
As the problem states that the distance can be upwards and downwards .
So we considering both the case . I am going to implement BFS to
implement it (Because requires the poped elements to trace back to the
Source node to check whether path is sorted)
Consider the tree Given in this link .. I am
My Dear friend ,
For Getting the Path above the source node here is the simple step ..
The below table illustrates it :-
During traversing the in BFS way from the root until we find the
source node .
Current Node = a | b c | d e
Distance from Root = 0 | 1 1 | 2 2
PrevNode
An array is given consisting of real integers , can hav repeatative
elements , Now u need to find K partitions whose union will hav all
the elements of the array , but the intersection of any pair of
cannot hav K elements in common.
Exam:-
Array- 1 1 2 2 3 1 4 3 5
For K=3 the partition are :-
But how does it ensure tht the elements been removed wouldnot give
the same set again
--
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
Suppose u have a square matrix, where every cell is filled with 0 or
1 . U need to find the maximum subsquare such that all four borders
are filled with all 1s.
Ex:-
1 0 0 1 1 0
1 0 1 1 1 0
0 0 1 0 1 1
0 1 1 1 1 0
1 0 0 1 1 1
Here the maximum square (3X3) possible is from the TOP LEFT (2 3) TO
Suppose u have n1 items of size s1,
n2 items of size s2 and n3 items of size s3. You'd like to pack
all of these items into bins each of capacity C, such that the
total number of bins used is minimized.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
How do u plan to implement it ???
--
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
If a natural number N is given such that N = a × b where a and b are
the factors of N. How many such sets of (a, b) can be formed in which
the selection of the two numbers a and b is distinctly different if N
= 8 × 33 and the distinct factors should be Prime to each other ?
--
You received this
Can any one give the pseudo code for creating suffix and tournament tree
??? Not able to find the proper algo in the net ,. tht's y asking for help
. plzz
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web
Given two arrays , one is 1D array and other is 2D array . Now u need to
find out whether 2D array contains the subset of 1D array . The elements
of 1D array not neccessary present in the same row it can be either on the
up or down but should be continuous in the 2D array ..
--
You received
Forgot to mention this was asked in Amazon Interview ..
--
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
1) how do u debug the code such tht u can know the compile time
error??
2) how do u judge/know exception going to arise ?? How we decide and
when??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
The hash table would be used by separate chaining method not open
addressing because it may not find the correct entry efficiently in
the hash table . In case of open addresssing the value gets entered in
the first available entry after collision.
In case of insertion :- (I have considered only
The written round will consist of 4 sets . Time 1hr 30 mins
First 20 question : C/C++ ( lots of segmentation error , run time and
compile time errors , pointer to function , and Binary Trees )
Second 20 quesitons : OS questions ( Page , Trashing , Demand paging ,
scheduling , throughout etc)
Focus on Algorithm , Data Structure and your coding skills , as they
can ask for proper working code at tht moment .
--
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
Just wondering when a element in a Vector is deleted/removed , is the
preceding elements r shifted left or it behave like a linked
list???
For both Java and C+++ ...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
#includecstdio
#includeiostream
using namespace std;
int main()
{
int w=10;
int *p=w;
int *x;
*x=1000;
int *y;
*y=100;
printf(%d %d %d,*x,*p,*y);
return 0;
}
Wht is the o/p ??
1)1000 10 100
2)1000 10 10
3)Compilation Error
4)Run Time Error
--
You received this message because you
OK Now try this ...
#includecstdio
#includeiostream
using namespace std;
int main()
{
int w=10;
int *p=w;
int *x;
*x=1000;
printf(%d %d ,*x,*p);
return 0;
}
Wht is the o/p ??
1)1000 10
2)1000 100
3)Compilation Error
4)Run Time Error
Any Difference ??
--
You
No check It once more in G++ Compiler
--
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
I think u haven't ran the the code or compile it .. It give the output
as 1000 10 .
Check tht ..
--
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
The code was bug free . I just asked why the code is still going
inside the blockof code where the condition (!feof() ) is
given ...Moreover it was been asked in an Interview for ur
information .. I have just introduced class on top of it .
You should perhaps read the question properly then
hello frnds , can u give any reason why this code is trying to read
when the file has reached the EOF ???
--
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
#includeiostream
#includecstdio
#includecstring
#includealloc.h
#includecstdlib
using namespace std;
class GraphClass
{
int arr[1000][1000];
int r,c;
public:
GraphClass()
{
for(int i=0;i1000;i++)
memset(*(arr+i),0,sizeof(*(arr+1)));
r=c=0;
}
void ReadFromFile(char *str)
{
includestdio.h
void fun(int);
typedef int (*pf) (int, int);
int proc(pf, int, int);
int main()
{
int a=3;
fun(a);
return 0;
}
void fun(int n)
{
if(n 0)
{
fun(--n);
printf(%d,, n);
fun(--n);
}
}
--
You received this message because you are
The O/P is 0,1,2,0,
But how
--
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
What are the pattern of questions asked by Ericsson ..
URGENT !!!
--
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
Can anyone tell me wht does banking firm ask in interview other than
Technical stuffs , algo , puzzles?? Any suggestion .
--
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
If u were asked this question in an interview , wht would be your
answer ?
Using Valgrind . If the interviewer ask without using other
software , then wht ???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Will It show the line number where the memory leak is present ???
--
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
How to detect in which line the Memory Leak has occured ?? I want the
line number where the Memory leak occurs ??? Give every wild answer u
can think off
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Logical Address ... as Physical address is not accessable tht's wht OS
does , it maps the physical address to the logical address .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Do u want the subarray consisting of consecutive elements ???
--
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
Yess ... For
For example :-
F(n) = | 1 1 |^n
| 1 0 |
For calculating a^n ... use the Exponential method Here a will be
your Matrix ..
int result (int a,int n)
{
int x=1,y=a;
while(n0)
{
if(n%2==1) x=(x*y); /* Instead of X=1 i(n case of
ODD ) substiute
http://en.wikipedia.org/wiki/Steinhaus%E2%80%93Johnson%E2%80%93Trotter_algorithm
U can try this too .. Without any recursion ...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Consider this Example:-
1 2 3 4 5 6 7 1 In CIrcle
1 kills 2
3 kills 4
5 kills 6
7 kills 1
Remaining ppl :- 3 5 7
3 kills 5
7 kills 3
Remain- 7
This is the sequence .. i guess Isit
--
You received this message because you are subscribed to the Google Groups
As I told earlier it is Josephus Problem ...
--
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 doubth .
For (d r0 + r1) ignore the point with smaller radius as it will
overshadowed the bigger circle completely
There may be a case where the circle is partially overlapped by the
other circles. Then this algo will fail .
The area will be of like these :-
Suppose 3 circles are there X,YZ
http://groups.google.com/group/algogeeks/browse_thread/thread/2ada4a0cd27036c2
This has already been discussed follow the above link .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
You can try this out :---
If the range of the number are in between -N to +N eg: -10^6 to
+10^6 , then take the the Absolute( Lower bound.) i:e N (10^6) .
For each number add it in the Index [i+N] ..
While printing the value of Number at Index X, Print the value in the
Index [X-N]..
You can do it using stack concept:--
Pop the element from the end , taking two variable index1, index2 and
Ch(character to Iterate)
Eg:- a1b4 here index1=4 , Ch='b', index2=1;
Start filling the element of Ch from the extreme end of the array ..
From right hand side .
The array will look
Yaa even if it is 8 bytes long . Compiler will treat the value 10 as 8
bytes only . It should be able to assign it to the pointer of the same
size (type) ..
Try to free the dynamically allocated memory just before return 0
and tell me the result after compilation . Try this :-
int main()
{
One question wht is the data structure used for the
Dictionary ... The algo is dependent on the Implementation of the
dictionary .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Nice solution dude . Like that one
--
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
For this you can use pascal triangle . It will give the permutation
value of the the series .
1
1 2 1
1 33 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 151
This can easily prepreocessed using dynamic method way .
a[0][i]=1 1=i=n
a[i][0]=1
Print the symbol ∞ (INFINITY) through code . Unicode ..
--
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
O(n) is possible . Will it serve the purpose or need less than that ???
--
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
Yaa this will work , you need to handle the case for odd number of
nodes .
For even number of node it will serve the purpose .
Yaa for the second part also you can use the ratio concept
fast pointer : slow pointer = 4:3
slow = ptr-next-next-next
fast = ptr-next-next-next-next
Here also we
Yaa guys it hav something to do with UNICODE ... I know that
On Jul 19, 3:32 pm, sagar pareek sagarpar...@gmail.com wrote:
yeah in my ubuntu too its not printing :)
On Tue, Jul 19, 2011 at 3:20 PM, SAMMM somnath.nit...@gmail.com wrote:
But if we use gcc or g++ . In that case
You can try this :-
fgets(buff,sizeof(buff),stdin) ..
It is recomended not to use gets in g++ or gcc ..
On Jul 19, 4:40 pm, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
the gets function gives me error when i execute the following code
plzz provide suggestions and answers
char
It is because it doesn't check any bound checking . So overflow can
easily occur without user's concent .
On Jul 19, 4:48 pm, Ankit Sablok ankitsablok19091...@gmail.com
wrote:
Y is it not recommended to use gets in g++ what is the exact reason
can u tell
On Jul 19, 4:47 pm, SAMMM somnath.nit
.
Moral of the story :-- Keep ur system upgraded .
On Jul 19, 5:24 pm, varun pahwa varunpahwa2...@gmail.com wrote:
printf(\u221E\n);
On Tue, Jul 19, 2011 at 4:10 PM, SAMMM somnath.nit...@gmail.com wrote:
Yaa guys it hav something to do with UNICODE ... I know that
On Jul 19, 3
are only valid in C++ and C99
but running... :)
On Tue, Jul 19, 2011 at 6:15 PM, SAMMM somnath.nit...@gmail.com wrote:
It's strange I tried it in GCC version 2.95.3 there is gives error ,
but in upper version it gives the correct answer .
I will thinking it will be same for different
This is done by using exponential theory :-
I am giving my code here for a^b
int power (int a,int b)
{
int x=1,y=a;
while(b0)
{
if(b%2==1) x=(x*y)
if (b/=2) y=(y*y);
}
return x;
}
Run time O(log b)
--
You received this message because you are subscribed to
Suppose N number of circle is given with their x y coordinate and
radius . Now the question is to find the total area covered by the N
circles .. Circles can be overlapping depending on their coordinates .
--
You received this message because you are subscribed to the Google Groups
Algorithm
See the input will be :-
6 No of circles
x1 y1 R1
x2 y2 R2
x3 y3 R3
x4 y4 R4
x5 y5 R5
x6 y6 R6
Output:-
Area occupied by the above circles (one line) 4 decimal points .
On Jul 19, 9:01 pm, priyanka goel priya888g...@gmail.com wrote:
can u pl tell wat is dis x y coordinate?
are dey
The logic which I have posted , it works on that principle only . Take
a good look . It is the standard way fopr finding the power of a
number . (a^b)
You take and example for a=3 and b=4 and test it in My posted code .
then you will understand wht is happening .
On Jul 19, 9:45 pm, snehi jain
on this principle . Give it a try . In my code You just
have to substitute 'a' By a matrix . That will server the purpose ..
I hope you doubth wil be clear .. As said earlier work with the
numbers first then you will get the logic .
On Jul 19, 9:54 pm, SAMMM somnath.nit...@gmail.com wrote
/*
INPUT:-
5 -- NO of testr cases
0
1
4
5
3
OUTPUT:-
2
*/
#includestdio.h
#includestdlib.h
int main()
{
int n=0,j=0,t=0,res;
res=0L;
scanf(%d,t);
while(t--)
{
scanf(%d,n);
res^=n;res^=j;
j++;
}
printf(%d\n,res^j);
return 0;
}
Example :--
4
0
4
1
3
Output:-
2 (Because
^=j; ?
i m not good in bits operations...
On Mon, Jul 18, 2011 at 1:24 PM, SAMMM somnath.nit...@gmail.com wrote:
/*
INPUT:-
5 -- NO of testr cases
0
1
4
5
3
OUTPUT:-
2
*/
#includestdio.h
#includestdlib.h
int main()
{
int n=0,j=0,t=0,res;
res=0L;
scanf
#includestdio.h
int main()
{
int a[]={1,2,3,5,2}; // 2 isrepeated and 4 is missing
int i=0,x=0,j=0,bit;
while(i5)
{
j^=i+1;j^=a[i];
i++;
}
bit=j~(j-1); //set bits
i=0;j=0;
while(i5)
{
if(bit(i+1)) x^=(i+1);//two set are needed to iterate
else j^=(i+1); //two set are needed to
This has to do with lvalue . because i++ require some place to store
it value .
On Jul 18, 1:10 pm, XYZ yourarunb...@gmail.com wrote:
I was also thinking about the order of expression evaluation in gcc!
No idea though!
--
You received this message because you are subscribed to the Google
Suppose a double Dimension array is given of order N x N . And it is
filled with distinct elements . Now you have to find the atleast one
row which neither contain the maximum or the minimum element among all
the elements present . The runtime complexity should be less than
O(N^2) .
--
You
94 matches
Mail list logo