On Fri, Aug 20, 2010 at 10:06 PM, Nikhil Agarwal
<nikhil.bhoja...@gmail.com>wrote:

> The solution for the above problem will be,
>
> 1.First convert all the smaller nos of by concatenating 9 at the end
> suppose 23,333 -> (239,333) to the size of the maximum digit.
> 2.Sort the numbers;
> 3.remove the 9 from the nos where we had concatenated.
> 4.concatenate the string
>
> eg1.
> 55 31 312 33 -> 559 319 312 339
> sort-> 312 319 339 559
> remove 9s-> 312 31 33 55
> concatenate-> 312313355
>
> eg2
> 6 5 9 111-> 699 599 999 111
> sort-> 111 599 699 999
> remove 9s-> 111 5 6 9
> concatenate-> 111569
>
> any counter egs are welcome.
>

Apologies ,this algorithm fails with 22 and 223 it gives 22322 instead of
22223 which is wrong
This is a working algo:
Suppose set is : [22,223,24,247]
1.Sort the no.s 22 24 223 247
2.append the no. smaller in size with the msb of next no at the end : 222
242 223 247
3. sort 222 223 242 247
4.remove the appended bits: 22 223 24 247

>
> On Fri, Aug 20, 2010 at 8:00 PM, Sakshi Handa 
> <sakshi.handa...@gmail.com>wrote:
>
>>
>> @srinivas
>> Following your method won't the answer be 31 312 33 55, which is not the
>> smallest concatenated no. here?
>>
>> On Fri, Aug 20, 2010 at 3:05 AM, srinivas reddy <srinivaseev...@gmail.com
>> > wrote:
>>
>>> @Divya chandrasekhar your algorithm doesn't satisfy the condition like
>>> {130,11}
>>>  we can give so many examples like this so the solution may come like
>>> this
>>>
>>> follow these rules:
>>> 1.imagine that all the numbers are equal length.(i.e;if the numbers are
>>> not equal lenth just add 0's at right hand side to the numbers which have
>>> less number of digits)
>>>
>>> 2.now arrange all these numbers in ascending order.
>>>
>>> 3.now remove the additionally added zero numbers from the numbers to get
>>> original numbers
>>>
>>> soon i wiil write the code
>>>
>>>
>>>
>>>
>>> On Fri, Aug 20, 2010 at 2:34 AM, Divya Chandrasekar <
>>> divyac1...@gmail.com> wrote:
>>>
>>>> Never mind. This algo doesn't work properly. Apologies.
>>>>
>>>>
>>>> On Thu, Aug 19, 2010 at 3:34 PM, Divya Chandrasekar <
>>>> divyac1...@gmail.com> wrote:
>>>>
>>>>> By the algo I gave :
>>>>>
>>>>> 1. Grouping -
>>>>> 3 digits - 111
>>>>> 1 digit - 6,5,9
>>>>>
>>>>> 2. Sorting within each bucket
>>>>> 3 digits - 111
>>>>> 1 digit - 5,6,9
>>>>>
>>>>> 3. Concatenation by descending order of number of digits, and
>>>>> increasing order within each digit bucket -
>>>>> Grouping would then be - 3 digit numbers in sorted order followed by 1
>>>>> digit numbers in sorted order
>>>>> 111 5 6 9
>>>>>
>>>>> Is there a number smaller than 111569 that can be formed with the set
>>>>> given?
>>>>>
>>>>> Also, I am not sure about the complexity of this algo.
>>>>>
>>>>>
>>>>> On Thu, Aug 19, 2010 at 1:56 PM, BALARUKESH SIVARAMAN <
>>>>> sbalarukesh1...@gmail.com> wrote:
>>>>>
>>>>>> @Divya :
>>>>>> Does the algo you gave work for the set { 6,5,9,111} ?
>>>>>> I hope it doesnt... Correct me if i am wrong....
>>>>>>
>>>>>> --
>>>>>> You received this message because you are subscribed to the Google
>>>>>> Groups "Algorithm Geeks" group.
>>>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>>>> To unsubscribe from this group, send email to
>>>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>>>> .
>>>>>> For more options, visit this group at
>>>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>>>
>>>>>
>>>>>
>>>>  --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to algoge...@googlegroups.com.
>>>> To unsubscribe from this group, send email to
>>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/algogeeks?hl=en.
>>>>
>>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algoge...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>>> .
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Sakshi
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks & Regards
> Nikhil Agarwal
> Senior Undergraduate
> Computer Science & Engineering,
> National Institute Of Technology, Durgapur,India
> http://tech-nikk.blogspot.com
> http://beta.freshersworld.com/communities/nitd
>
>
>


-- 
Thanks & Regards
Nikhil Agarwal
Senior Undergraduate
Computer Science & Engineering,
National Institute Of Technology, Durgapur,India
http://tech-nikk.blogspot.com
http://beta.freshersworld.com/communities/nitd

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

Reply via email to