int func(int start,int end)
{
int count=0;
for(int i=start;i=end;i++)
{
int tmp=i;
while(tmp!=0)
{
tmp=tmp(tmp-1);
count++;
}
}
return count;
}
Worst Case complexity : O((b-a)*32)
Please let me know if there is another gud way to do
@Navin : Why r u sorting the array .. BST can be made using the preorder
traversal if null nodes are well defined in the given traversal.. Right??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
??
--
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/-/HQ_TvoKSLNgJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
@Navin : Read a line .. store it in a string .. then extract numbers frm
it.. It will be more faster i think.. :)
On Wednesday, 4 July 2012 22:44:04 UTC+5:30, Navin Kumar wrote:
Suppose a file.txt contains : 50 40 30 # # 5 # 10 # #
i want to fetch only integers. How should i fetch it. I
@Sharad.. Thanx.. :)
On Jan 31, 2:42 am, sharad dixit sharad.emine...@gmail.com wrote:
@zyro May be this solves your problem...
#include iostream
using namespace std;
int main()
{
int no;
char digit[50];
int counter=0;
cin no;
do
Write a function that takes an integer and returns a char array that
contains the -2 (minus 2) base representation of the given integer.
Example:
Input Output
7 11011
3 111
2 110
Plzzz help ???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
@Anika
7 = 1*((-2)^4) + 1*((-2)^3) + 0*((-2)^2) + 1*((-2)^1) + 1*((-2)^0) ...
simlilary for other numbers...
--
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
along with its difference
b. add the difference of the newly added element.
O(nlogn)
On Nov 19, 11:36 am, Zyro vivkum...@gmail.com wrote:
sorry...minimize sum of the difference between the elements of the
subset..
On Nov 19, 10:03 am, shady sinv...@gmail.com wrote:
what
Q: Select the K elements in an array of size N which are having the
minimum difference among them?
For Example : If you have an array like arr[]={9,5,2,6,3,11} and value
of K is 3. Then ans would be {2,3,5}.
--
You received this message because you are subscribed to the Google Groups
Algorithm
?
On Nov 18, 6:30 pm, Zyro vivkum...@gmail.com wrote:
Q: Select the K elements in an array of size N which are having the
minimum difference among them?
For Example : If you have an array like arr[]={9,5,2,6,3,11} and value
of K is 3. Then ans would be {2,3,5}.
--
You received
.
On Nov 19, 10:03 am, shady sinv...@gmail.com wrote:
what do you mean by difference among them ?
do we need to select the elements to minimize the sum between
consecutive elements ? or only the first and last element ?
On Nov 18, 6:30 pm, Zyro vivkum...@gmail.com wrote:
Q: Select the K
11 matches
Mail list logo