Can u please the big integer concept how to manage when the input size is very high for the arrays ?
I am getting the segmentation fault.??
what should be the different approaches:
- allocate memory in run time.
- Global or something else??
Can u please the big integer concept how to manage when the input size is very high for the arrays ?
I am getting the segmentation fault.??
what should be the different approaches:
hello @Vikaspal
pls refer this -> https://www.geeksforgeeks.org/stack-vs-heap-memory-allocation/
generally global scope allows to declare some large size array then the function scope.
so if u need large size (<10^8) Then declare it as global.
note -> we cannot create array greater than 10^8 because it will take too much memory .
@aman212yadav bro, when we allocated the memory inside during compile time then the suffficent memory is allocated by the compiler, or call it stack memory allocations. but when we declare the varible or memory globally is also known to the compiler right??? and automatically allocatation and deallocation is happen…
but when we create the memory on runtime using pointer it will allocated by us and do we need to delete them also ??
and in contents mostly heap memory method is used ??
yeah that happens during compile time only.
we allocate memory at runtime using new keyword and store that allocated memeory address in pointer.
it is our responsibilty to delete that allocated memory once we r done .
mostly we use dynamic allocation over static allocation because

what will the time complexity if we divide the arrays into three parts instead of two and also when we take temp arr to store the result does it counted in space complexity???
t(n)=3t(n/3) + o(n)
this will be the recurrence relation.try to solve it.
@aman212yadav ya got it i thinks will always left with 0(N) --> nlogn so there is no effect whether we divide in how many parts right??
in this case base of log will 3.
whereas in case of original mergesort it is 2.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.