One threading is printing 2,4,6,8,10 all even numbers and another thread is printing 1,3,5,7,9 all odd number, how you will print 1 to 10 in sequential manner
a.Add(12); a.Add(1); a.Add(0); a.Add(10); a.Add(4); a.Sort();
a.Add(12);
a.Add(1);
a.Add(0);
a.Add(10);
a.Add(4);
a.Sort();
I think create a volatile sorted list class level variable and assign the values in the each thread, once both of the threads are finished, iterate through the sorted list to print the outcome? Please correct me.