[algogeeks] Malloc, return address order.

2006-03-07 Thread Manu

Hello,

Can we say that the return addresses from the various malloc function
calls, in a program, will always be in a predefined order (increasing
or decreasing,  depeding on how the heap is managed) ? 

regards
Manu


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: Malloc, return address order.

2006-03-07 Thread adak

In C, if it is a struct, each member will be next to (after any
necessary padding), the next member. Same for arrays.

Anything else is not guaranteed. iirc

You can test what memory addresses are being allocated, of course, and
I'm sure you'll find adjacent order, AT FIRST, before any memory
fragmentation has been done.

Why not print out five or six addresses that are allocated right at the
start of a program, and then repeat that after your program has used
some memory elsewhere, and only released some of it.

You could make a display on-screen as the different addresses are
allocated, even.  Perhaps someone on Sourceforge.net has already done
this?

Adak


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: Malloc, return address order.

2006-03-07 Thread zavandi
On 3/7/06, Manu [EMAIL PROTECTED] wrote:

 Can we say that the return addresses from the various malloc function
 calls, in a program, will always be in a predefined order (increasing
 or decreasing,  depeding on how the heap is managed) ?

Nope. The C99 standard says (section 7.20.3):

The order and contiguity of storage allocated by successive calls to
the calloc,
malloc, and realloc functions is unspecified.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: E-book needed

2006-03-07 Thread Ankur Khetrapal
pls. send a copy to me too.. .
On 3/7/06, §ågãr Guptã [EMAIL PROTECTED] wrote:


plz send it to me also. wud be really grateful.

thanks
sagar

On 3/7/06, jsshah 
[EMAIL PROTECTED] wrote: 

I have emailed you the book in pdf format to your gmail account ...enjoy ... the book is considered the best in the field of algo ... its 
my fav ... lil mathematical ... but sure to make the reader master ofalgoprogrammer_2004 wrote: Hi Everybody, Can somebody please forward me a goodebook on Algorithms. Its 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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: E-book needed

2006-03-07 Thread Cheng Zhang

Just curious, what's the name of this book?


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: compression of graph nodes

2006-03-07 Thread Bing

I think your data structure and the algorithm can not deal with a large
amount of nodes and edges.
The connectivity algorithms explained in Algorithms in C I~IV by Robert
may solve this problem, too.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] need help help n help!!!

2006-03-07 Thread gcet

hi guys need help..please

1. each student in a group of n students is scheduled to work one
shift, where each shift is a single congiguous interval of time. there
can be multiple shifts going on at once. devise an effiecient algorithm
to choose a smallest subset of these n students to form a committee so
that for ever student not on the committee, that students's shift
overlaps(at least partially) the shift of some student who is on the
committee.

2.
given a sequence of n distinct numbers a1,a2,.,an , a pair (ai,aj)
is known as significant inversion if ij and ai2aj. give O(n lg n)
algorithm to count the number of significant inversions in the given
sequence.

3. let a machine known as, equivalence tester, can determine whether
two bank card correspond to the same account by taking two cards at a
time as input and outputting whether they are equivalent. give an
algorithm which invokes equivalence tester at most O(nlgn) to determine
whether there is a set of more than n/2 equivalent cards in the given n
bank cards.

i appreciate your time...

thank you
please reply


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: E-book needed

2006-03-07 Thread Vinodh Kumar
Hi jatin,
why not send the book to the group
vinodh

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]  For more options, visit this group at http://groups.google.com/group/algogeeks  -~--~~~~--~~--~--~---


[algogeeks] Re: need help help n help!!!

2006-03-07 Thread SPX2

i believe for the second problem it is enough to sort them using
quicksort method in O(nlgn) but retain a vector with initial
positions(wich after quicksort is applied will be a permutation vector
of the original one).
Now you have to find out number of pairs (ai,aj) with ij and
ai2aj.
Now this could be done by aproximating 2aj in the vector,by this i
mean,find the nearest upper value for 2aj in the vector.And If the
vector is sorted than all the elements of the vector over it,including
it will respect the significant inversion property with respect to 2aj.
So,mathematically.
N will be number of sig inv.
n is number of pairs

N;
j=1,n
find ah with min(2aj,ah) and ah2aj
N=N+n-h.

...quite straight forward...


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: need help help n help!!!

2006-03-07 Thread SPX2

Finding ah...isnt that simple... you have to do a binary search for
it... that means
that if you're on step j in the for above...you will have to do
(n-j)lg(n-j)computations
well...I think it would bring the algorithm to a total of O(sum from
j=0 to n of (n-j)lg(n-j)
O(n^2lgn)
if anyone can improve or find a better way...


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: compression of graph nodes

2006-03-07 Thread SPX2

store in whatever you like,be it father/son vector,vector of double
linked lists,matrix of adjacency,whatever.it is true you only have to
walk from node 1 to 6 in all the ways possible.
Now to do this it is true that you can use what was suggested a depth
first search.
And what you have to do after you have found path a1...an with a1 input
and an output
is to try to remember the cost of the path in a vector.
that is all i think
Depth path will assure different pathways.
If you want the fastest path you can use dijkstra/royfloyd.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] Re: largest Number Smaller Than Given Number

2006-03-07 Thread SPX2

Dhyanesh im not very sure about previous permuatation
The question is.
Is the prev_permutation() smaller in lexicographic order from the
current 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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---



[algogeeks] may be greedy approach

2006-03-07 Thread gcet

hi all,
sorry for reposting but i have many different problems so i thought
will put all seperatly..
Q.
 each student in a group of n students is scheduled to work one
shift, where each shift is a single congiguous interval of time. there
can be multiple shifts going on at once. devise an effiecient algorithm

to choose a smallest subset of these n students to form a committee so
that for ever student not on the committee, that students's shift
overlaps(at least partially) the shift of some student who is on the
committee.

can anybody tell me correct approach...

thanks for your time


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~--~~~~--~~--~--~---