here the n values is 100000000 . so when I declare this size as an array I m getting the segmentation fault. What the solution when we have large constraints?
Large input arrays bubble sort
@Vikaspal
Hey You misunderstood the question value of n is not upto 1000000000. the values of array is in range -1000000000 to 1000000000.
declaring array of size 1000000 will work fine for all tescases.
@shrm.abhishek.kmr means the int value that arrays is going to take is range between 1000000000.
but in the question how should u are going to assume that this 1000000 arrays size is sufficient because they haven’t mention that how many element is going to be in arrays
And also when we have this large arrays input in some question what should we do to avoid the memory contraints
@Vikaspal
In my whole journey of coding I never found such case. If there is some question in which you realise that there is need of declaring large array, you must have to think in some other way. There must be always some other way to solve that question. As per my knowledge you can declare array of size 10^7 (In some cases)
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.