[algogeeks] Re: Help woth LISP

2012-07-09 Thread Geoffrey Summerhayes
and then the 'bishop' diagonal. The bishop test is a bit tricky, it looks at (x rows up, y columns across from a previously placed queen) If x and y are equal it's on the diagonal. -- Geoffrey Summerhayes On Sunday, July 8, 2012 8:00:54 PM UTC-4, Victor Manuel Grijalva Altamirano wrote: The next solve

[algogeeks] Re: Hashing problem with collision

2010-01-07 Thread Geoffrey Summerhayes
On Jan 6, 2:54 pm, Vijay hello_mis...@rediffmail.com wrote: Hi All, I have one question about Hashing. Say I have one Hash table where index Hash_function(key) function will return index value of corresponding string/key. Hash_insert(key) function it will take key and get converted index

[algogeeks] Re: Hashing problem with collision

2010-01-07 Thread Geoffrey Summerhayes
On Jan 7, 10:10 am, Vijay hello_mis...@rediffmail.com wrote: Thanks for response. Can you please tell me what will be the contains of Hash table and how searching works? Lets say, we have one data like Key       Data === IP1 -  Sys1 IP8    Sys8 IP2    Sys2 Lets say, there

[algogeeks] Re: parallel algorithm: find majority element

2009-12-11 Thread Geoffrey Summerhayes
On Dec 9, 2:52 am, sankethm7 74.san...@gmail.com wrote: Hello folks, does anyone have idea to solve the problem given below: Assume that A[1…n] is an array a.      Describe an efficient parallel algorithm that uses n processors to find the majority element of A         time complexity  =

[algogeeks] Re: Can you guys help me how to approach this problem !!!

2009-12-07 Thread Geoffrey Summerhayes
to be in nlogn. Any ideas guys ? -- Vinod On Dec 2, 11:02 pm, Geoffrey Summerhayes sumr...@gmail.com wrote: On Dec 2, 10:42 am, Geoffrey Summerhayes sumr...@gmail.com wrote: It's a binary tree, [ 7 3 4 1 2 6 5 8]  has children [ 7 3 4 1 2 6 5] and [ 3 4 1 2 6 5 8], all the way down

[algogeeks] Re: Can you guys help me how to approach this problem !!!

2009-12-02 Thread Geoffrey Summerhayes
On Dec 2, 6:45 am, Vinoth Kumar vinoth.ratna.ku...@gmail.com wrote: These are the steps for the O(n^2) solution n=length of A for each subarray  A[i,j]  where ji        min=min(A[i,j])        max=max(A[i,j])        if(max - min==size (A[i,j]) print A[i,j] min[A[i,j]]=min( A[j],

[algogeeks] Re: Can you guys help me how to approach this problem !!!

2009-12-02 Thread Geoffrey Summerhayes
On Dec 2, 10:42 am, Geoffrey Summerhayes sumr...@gmail.com wrote: It's a binary tree, [ 7 3 4 1 2 6 5 8]  has children [ 7 3 4 1 2 6 5] and [ 3 4 1 2 6 5 8], all the way down to [ 7 3] [3 4] [4 1] ... If you start at the bottom keeping track of min and max for each node, if max-min == node

[algogeeks] Re: Advice about choice of algorithm

2009-11-27 Thread Geoffrey Summerhayes
On Nov 25, 5:31 pm, bingbang thebiggestbangthe...@gmail.com wrote: Dear all, I am a newbie here, this is my first post. I have looked over a few algorithms and have searched this board for my question but have not been able to narrow down to a clear answer. I am looking for any

[algogeeks] Re: Search in a sorted NxN matrix

2009-11-25 Thread Geoffrey Summerhayes
Not a bad start, it can eliminate areas. n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n ?? ?? ?? ?? n n n n So it would involve searching in the two remaing blocks, recursively until you get an 1xN or Mx1 then a binary

[algogeeks] Re: Search in a sorted NxN matrix

2009-11-25 Thread Geoffrey Summerhayes
Hmmm. Same idea, much more analysis. I feel good, I spent a lot less time thinking about it. Splitting the search areas into squares is a great idea. -- Geoff On Nov 25, 8:43 am, Rohit Saraf rohit.kumar.sa...@gmail.com wrote: A research article on this question.. Rohit Saraf Sophomore

[algogeeks] Re: ant problem

2009-11-08 Thread Geoffrey Summerhayes
On Nov 6, 11:08 am, ankur aggarwal ankur.mast@gmail.com wrote: @geoffery plz give your method.. Simple enough, xe's analysis is correct, except xe starts at L1. The ant starts at the origin and moves to L1 with a probability of 1, accounting for one extra minute. So the answer is eight.

[algogeeks] Re: finding the minimum distance to travel

2009-10-27 Thread Geoffrey Summerhayes
On Oct 26, 12:56 pm, eSKay catchyouraak...@gmail.com wrote: This is one of the old puzzles, but I couldn't reason out how ppl get to the answer they say. An ant has to crawl from one corner of a room to the diametrically opposite corner as quickly as possible. If the dimensions of the room

[algogeeks] Re: creating a square hole

2009-10-27 Thread Geoffrey Summerhayes
Google - Watts Brothers square hole drills. Not completely square leaves slightly rounded corners. On Oct 27, 8:05 am, eSKay catchyouraak...@gmail.com wrote: Can we drill a square hole by using a Reuleaux triangle, atleast theoretically? --~--~-~--~~~---~--~~

[algogeeks] Re: interesting game

2009-10-04 Thread Geoffrey Summerhayes
On Oct 3, 4:49 am, eSKay catchyouraak...@gmail.com wrote: okay... perhaps It's a 2-player game that's deterministic, zero-sum, perfect information, finite, and without ties. So a winning strategy exists for one of the players. should have been mentioned... I didn't know that. Btw, what

[algogeeks] Re: interesting game

2009-10-02 Thread Geoffrey Summerhayes
On Oct 2, 7:20 am, eSKay catchyouraak...@gmail.com wrote: What exactly do you prove here? The first player always has a winning move. You just make some statements, which should be proved. shouldn't it? Or am I missing something?? It's a 2-player game that's deterministic, zero-sum,

[algogeeks] Re: Citrix interview question

2009-09-15 Thread Geoffrey Summerhayes
On Sep 15, 9:15 am, nitin mathur nitinkumar.mat...@gmail.com wrote: @ Tanmoy Same logic I explained..interviewer didn't give me any clue whether the explaination is correct or not.. but when I googled it now I found the answer 56. Still not correct. The standard was specific (I assume the

[algogeeks] Re: Citrix interview question

2009-09-15 Thread Geoffrey Summerhayes
On Sep 15, 11:10 am, CM Saikanth Varma saikanthva...@gmail.com wrote: The answer is indeed 56. Explanation: Increment operator has highest priority so (i++)*(i++) will be evaluated as (7)*(8)=56 This is valid only in C I don't have the final c99 standard available, this is from the

[algogeeks] Re: crazy man in the airplane

2009-09-11 Thread Geoffrey Summerhayes
On Sep 11, 10:32 am, Karthik Singaram Lakshmanan karthiksinga...@gmail.com wrote: The deal is that if anyone chooses seat 1 then everyone else will go to their proper places and person 100 will get seat 100 The probability of passenger 1 choosing seat 1 is (1/100) Say, he chooses seat

[algogeeks] Re: birthday panga

2009-09-04 Thread Geoffrey Summerhayes
On Aug 27, 5:19 am, ankur aggarwal ankur.mast@gmail.com wrote:   Implement the birthday diary calendar to keep records of all birthdays of your friends 1) what underlying data structure(s) you will use so that the memory consumption should be optimum [i.e if you have only 12 birthday

[algogeeks] Re: minimum difference.

2009-09-02 Thread Geoffrey Summerhayes
On Sep 1, 8:02 pm, Ramaswamy R ramaswam...@gmail.com wrote: Brute force, pick all combinations and keep track of minimum difference. Complexity: O(n^2) - (n-1)+(n-2)+(n-3) ... 1 A little better, use any of the O(nlog n) sorting algorithm. In O(n) compare adjacent pairs and find the minimum

[algogeeks] Re: find elements in array with odd frequency

2009-08-24 Thread Geoffrey Summerhayes
On Aug 23, 5:00 am, Dufus rahul.dev.si...@gmail.com wrote: Idea is simple either to keep a count and emit elements with odd count (frequency) or XOR element with itself for each time it occurs in input and then emit elements which have non zero XORed result(which basically corresponds to

[algogeeks] Re: Number in set of intervals?

2009-08-13 Thread Geoffrey Summerhayes
On Aug 13, 5:49 am, Arthur Milfait a...@gmx.info wrote: hi there, actually i am programming a software that loads numbers for radios in a trunking system from a file and has to check each number if it is a number for a group of radios. criterion to be the number of a radiogroup is, that

[algogeeks] Re: Room Permutation Algorithm

2009-07-07 Thread Geoffrey Summerhayes
On Jul 6, 12:34 pm, lad4bear lad4b...@gmail.com wrote: Hi Guys, Here is my situation. The set of room types available is [s, d, t]. A user specifies the number of rooms required [n] and I have to generate a list of permutations. So where n=3 we get [sss, ssd, sst, sdt, std, etc] The

[algogeeks] Re: Slitherlink - a loop around a grid with requirements on how many times you border certain squares

2009-04-09 Thread Geoffrey Summerhayes
On Apr 6, 10:32 pm, James rent.lupin.r...@gmail.com wrote: A puzzle I'd not seen before appeared in a recent copy of The Independent, called Slitherlink. Seehttp://en.wikipedia.org/wiki/Slitherlinkandhttp://www.puzzle-loop.com/ To quote the rules verbatim: Draw a single loop by

[algogeeks] Re: bank card problem

2008-12-13 Thread Geoffrey Summerhayes
On Dec 11, 11:03 am, Miroslav Balaz gpsla...@googlemail.com wrote: i think it will not perform good, if you have cards like this 1 2 3 4 5 5 5 5 Actually it's not all that bad in this case, it terminates when it reaches the first occurence of 5. (1 2 3 4 5 5 5 5 5) is much worse. the

[algogeeks] Re: bank card problem

2008-12-11 Thread Geoffrey Summerhayes
On Dec 9, 2:22 pm, Tower [EMAIL PROTECTED] wrote: A bank has a collection of n bank cards that they’ve confiscated, suspecting them of being used in a fraud. Each bank card corresponds to a unique account in the bank. Each account can have many cards corresponding to it, and we’ll say that

[algogeeks] Re: Covering grid with pentominoes - duplicated solutions

2008-11-27 Thread Geoffrey Summerhayes
On Nov 26, 5:07 pm, Miroslav Balaz [EMAIL PROTECTED] wrote: That was joke? I never heard of any dancing links :) Google is a wonderful tool. In the time it took to write your reply, you could have been reading the original paper. the algorithm in more detail let the grid by n rows m columns

[algogeeks] Re: Covering grid with pentominoes - duplicated solutions

2008-11-26 Thread Geoffrey Summerhayes
On Nov 25, 6:34 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello, I'm trying to write an algorithm counting all possible ways (symmetry included) a grid of dimensions NxM can be covered with a prescribed subset of pentominoes. (http://en.wikipedia.org/wiki/Pentomino). The algorithm

[algogeeks] Re: Covering grid with pentominoes - duplicated solutions

2008-11-26 Thread Geoffrey Summerhayes
On Nov 26, 1:40 pm, Miroslav Balaz [EMAIL PROTECTED] wrote: It is too slow, i replied with better solution , bu i dont know how this forum works. I was looking for comments on correctness, not efficency. As I said, it can be improved. By quite a bit, actually. As for your 'better solution',

[algogeeks] Re: Geometric Algo..

2008-11-21 Thread Geoffrey Summerhayes
On Nov 20, 11:58 pm, Ralph Boland [EMAIL PROTECTED] wrote: On Nov 20, 1:46 pm, Monty [EMAIL PROTECTED] wrote: Hi Frndz,     If there are n points on the circumference of circle(order not known) ,how can we find out the closest pair in complexity O(nlgn)... pls help with the

[algogeeks] Re: String and Array Performance Issue

2008-11-05 Thread Geoffrey Summerhayes
On Nov 5, 9:01 am, Adrian Godong [EMAIL PROTECTED] wrote: Yes, but that'll be too complex. I have tried the string.compare and it works like wonder! Shave off a lot of computing time. WTF!? Using a pipe delimited string and string operations to keep track of over 1000 values is the simple

[algogeeks] Re: Algorithm needed for optimizing a grid layout

2008-10-15 Thread Geoffrey Summerhayes
On Oct 15, 3:32 am, moonlight [EMAIL PROTECTED] wrote: I wanted to check if this algorithm would work for me, but apparently it's kept secret. I searched through wiki, google, etc. but could not find any resource in any programming language. Could anyone point me to a good algorithm library

[algogeeks] Re: Sorting an array*

2008-10-14 Thread Geoffrey Summerhayes
On Oct 13, 10:52 am, sharad kumar [EMAIL PROTECTED] wrote: its possible take gn array. find median then split arraay in two halves split it till it becomes smallest no. then exchange each even no with odd and merge them.= till u get original array. almost the reverse form of merge sort

[algogeeks] Re: Algorithm needed for optimizing a grid layout

2008-10-09 Thread Geoffrey Summerhayes
On Oct 9, 4:00 am, moonlight [EMAIL PROTECTED] wrote: *snip* Obviously, some input data may yield this not solvable, such as when user defines imageMinSide smaller than the width of target area. The algorithm should collect satisfying results and return the one with the largest number of

[algogeeks] Re: example of a logic bug using pseudocode

2008-07-22 Thread Geoffrey Summerhayes
On Jul 22, 12:32 am, popeyerayaz [EMAIL PROTECTED] wrote: Gentleman, I have the following question: 9. Present an example of a logic bug using pseudocode and explain your answer. (10 points) I just want the group to verify if my answer is correct. Here is my answer: Temperature = 70  

[algogeeks] Re: Color Matching Paint at the hardware store Algos

2008-06-24 Thread Geoffrey Summerhayes
On Jun 24, 2:16 pm, M. Funkibut [EMAIL PROTECTED] wrote: But how do you get from RGB to the paint formula?  Can you go from a paint formula to RGB? Does anybody know where I can find a reference book/article on this? I've looked and come up empty. Don't really know how they did it. But I

[algogeeks] Re: linked list

2008-06-23 Thread Geoffrey Summerhayes
On Jun 22, 3:01 pm, Tejas Kokje [EMAIL PROTECTED] wrote: On Jun 11, 12:25 am, zee 99 [EMAIL PROTECTED] wrote: is this the best one even if the list is sorted ( or any other constraint like this is applied ) ?? On 6/11/08, Mohammad Moghimi [EMAIL PROTECTED] wrote: No, I think O(n)

[algogeeks] Re: algo for finding the union of two sets ...

2008-06-23 Thread Geoffrey Summerhayes
On Jun 23, 12:36 pm, zee [EMAIL PROTECTED] wrote: do we have an algo for finding the union of two sets ??? Lots of them. data structure suitable for set operations Depends. The only real constraint in the definition of a set is that the elements are unique. So the choice of structure

[algogeeks] Re: linked list

2008-06-11 Thread Geoffrey Summerhayes
On Jun 11, 3:25 am, zee 99 [EMAIL PROTECTED] wrote: On 6/11/08, Mohammad Moghimi [EMAIL PROTECTED] wrote: On Wed, Jun 11, 2008 at 10:03 AM, zee99. 99 [EMAIL PROTECTED] wrote: is there any algo that can search a linked list in less than O(n) time No, I think O(n) is the best method one can

[algogeeks] Re: linked list

2008-06-11 Thread Geoffrey Summerhayes
On Jun 11, 12:09 pm, Douglas Diniz [EMAIL PROTECTED] wrote: Well, if you have a classic linked list, O(n) is the best for you. But you can do better if you have a sorted linked list. In every node keep a vector of pointers for all other nodes. Then you can simulate a binary search. LOL ...

[algogeeks] Re: recursive to non recursive algorithm

2008-06-06 Thread Geoffrey Summerhayes
On Jun 6, 1:40 pm, zee 99 [EMAIL PROTECTED] wrote: hi learnt that a tail recursive algorithm can be converted to a non recursive one by merely using a while and a goto is it true for all class of recursive algorithms or just the tail recursive ones ... All. In fact there are several

[algogeeks] Re: STL map uses Hashing?

2008-05-29 Thread Geoffrey Summerhayes
On May 29, 2:46 am, Vinodh [EMAIL PROTECTED] wrote: I am reading about hashing techniques. The map data structure available in C++ STL uses hashing techniques? It's been more than a few years since I looked at the standard, but I believe the actual algorithm is left unspecified. There are

[algogeeks] Re: STL map uses Hashing?

2008-05-29 Thread Geoffrey Summerhayes
On May 29, 10:43 am, Akhil Ravidas [EMAIL PROTECTED] wrote: On Thu, May 29, 2008 at 8:08 PM, Geoffrey Summerhayes [EMAIL PROTECTED] wrote: Easiest way to find out implementation details is to just read the header file on your implementation. Look for stl_tree.h . No, look at the C

[algogeeks] Re: Enumerating trees

2008-05-16 Thread Geoffrey Summerhayes
On May 15, 4:33 pm, Bruno Avila [EMAIL PROTECTED] wrote: Given the conditions for the subgraphs, it's always possible to create a graph that limits the size of all the acceptable subgraphs to less than three nodes. In the problem, there are no constraints on the cardinality of the

[algogeeks] Re: Enumerating trees

2008-05-14 Thread Geoffrey Summerhayes
On May 14, 8:39 am, pramod [EMAIL PROTECTED] wrote: Let's say we have E number of edges and V number of vertices. Any subgraph which is a tree with V vertices will have V-1 edges. So we need to retain V-1 edges and eliminate the rest E-(V-1). So in a brute force manner if we retain any set of

[algogeeks] Re: Enumerating trees

2008-05-14 Thread Geoffrey Summerhayes
On May 14, 12:41 pm, Bruno Avila [EMAIL PROTECTED] wrote: (reformatting last email) These are good questions. In my problem, a binary tree is different if the set of nodes are different. For example: a We have 9 different binary trees: {a}, {b}, {c}, \

[algogeeks] Re: Enumerating trees

2008-05-14 Thread Geoffrey Summerhayes
On May 15, 12:07 am, pramod [EMAIL PROTECTED] wrote: Geoff, How did you arrive at the V(V+1)/2 figure? V nodes in the graph, so V trees consisting of a single node. Then since the graph is given as connected, there must be a least one path between each pair of nodes. Even if there is more

[algogeeks] Re: Enumerating trees

2008-05-13 Thread Geoffrey Summerhayes
On May 12, 8:20 pm, brunotavila [EMAIL PROTECTED] wrote: Hi people, How to calculate the number of binary trees that are subgraphs of a given connected, undirected, unweighted and simple (no parallel edges nor loops) graph? Haven't given it too much thought, but I believe the number is

[algogeeks] Re: what is the best solution for this kind of searching ?

2008-02-22 Thread Geoffrey Summerhayes
On Feb 22, 9:01 am, Ridvan [EMAIL PROTECTED] wrote: Well if some preprocessing may be done just store the largest number and increase it. If the number has to be somewhere in between the 100 numbers I would do it in this way: Define a Range class: Range{int min, int max} In the

[algogeeks] Re: national informatics olympiad problem

2008-02-06 Thread Geoffrey Summerhayes
On Feb 6, 12:30 pm, robin [EMAIL PROTECTED] wrote: Hi I was trying to solve problem number 5 from 15th bulgarian informatics olympiad. on the following website: http://www.math.bas.bg/bcmi/noi99.html (we have to find the minimum and maximum possible values of numbers on the star