C language tricky good pointers questions answers and explanation operators data types arrays structures questions functions recursion preprocessors, looping, file handling, strings questions switch case if else printf advance c linux objective types mcq faq interview questions and answers with explanation and solution for freshers or beginners. Placement online written test prime numbers Armstrong Fibonacci series factorial palindrome code programs examples on c c++ tutorials and pdf

the program contains 2 functions. The first 1 divides the list,in this case, the array into small chunks of items. each chunk having 1 or at most 2 items. here,we use recursion to divide the list into these chunks.

the second function takes these chunks and set it in a temporary array temp[] according to its value. no recursion takes place here. left is 0, right=n-1 and mid=mid index. (u need to preserve the value of left and right.. so put them in variables say l,r) now a variable say t is initialized as 0,or left as left is 0.(it will provide index for temp[]) compare the values in the merge[] for indexes l and mid. in case l is small, inc l by 1. if mid is small inc. mid by 1 and in both the steps put the small value in temp[].

even i learnt it today only. and have some doubts in the final steps. i have no idea about why the penultimate if else statement is used. but i am sure about this much.

#6/3/13.. i guess u have ur exam tomorrow.. even i have.. all the best..

penultimate if else is used for the case when either of the both half gets sorted while the remaining has not been sorted.This if else will sort the remaining part also.

when there is more than one recursive calls then the thing that should be noted is value will be received only in the calling function so u need to be aware that which function is calling and where's my value receiving.

plz give me its algorithm..

ReplyDeletei'm quiet confuse every time when more than two recursion function calling...plzzz give me some idea... & help me to solve such a situation ...

ReplyDeleteThank you, sir. It works like a charm.

ReplyDeletesame here confused with more than one recursions :( can you give me some ideas

ReplyDeletepls give its algo

ReplyDeletethe program contains 2 functions. The first 1 divides the list,in this case, the array into small chunks of items. each chunk having 1 or at most 2 items. here,we use recursion to divide the list into these chunks.

ReplyDeletethe second function takes these chunks and set it in a temporary array temp[] according to its value. no recursion takes place here.

left is 0, right=n-1 and mid=mid index.

(u need to preserve the value of left and right.. so put them in variables say l,r)

now a variable say t is initialized as 0,or left as left is 0.(it will provide index for temp[])

compare the values in the merge[] for indexes l and mid. in case l is small, inc l by 1. if mid is small inc. mid by 1 and in both the steps put the small value in temp[].

even i learnt it today only. and have some doubts in the final steps.

i have no idea about why the penultimate if else statement is used. but i am sure about this much.

#6/3/13.. i guess u have ur exam tomorrow.. even i have.. all the best..

Can u tell the formula for counting the number of times the basic operation is repeated??

ReplyDeletepenultimate if else is used for the case when either of the both half gets sorted while the remaining has not been sorted.This if else will sort the remaining part also.

ReplyDeletewhen there is more than one recursive calls then the thing that should be noted is value will be received only in the calling function so u need to be aware that which function is calling and where's my value receiving.

ReplyDeletewhy max 50 was used

ReplyDeleteusing max 50 is not a must. . . it s just 2 specify the array size. . .

Deletethank u.

ReplyDeleteTHANK YOU SO MUCH

ReplyDelete