jagan
BAN USERWith less complexity
#include <stdio.h>
#include <stdlib.h>
int main()
{
int multiplicant,multiplier,i,result=0;
scanf("%d",&multiplicant);
scanf("%d",&multiplier);
for(i=0;i<multiplicant/2;i++)
{
result+=multiplier;
}
result+=result;
if(multiplicant%2 !=0){
result+=multiplier;
}
printf("result =%d",result);
return 0;
}
GC marks only reachable objects and move/copy these objects to other area of heap based on the GC type - compacting or copying garbage collectors.
Refer:
en.wikipedia.org/wiki/File:Animation_of_the_Naive_Mark_and_Sweep_Garbage_Collector_Algorithm.gif
lambda.uta.edu/cse5317/notes/node47.html
Garbage Collector uses mark and sweep algorithm, In the first phase(mark) only reachable objects are marked by GC as reachable and remaining objects are treated as unreachable, these will be reclaimed during second phase(sweep) of GC.
GCs are Sequential, Parellel and Concurrent
For integers
- jagan December 07, 2015