Programming in software is the main skill every software company needs, while going to any developer interview some of the questions would tense us a lot. We will solve some of those related questions with best performance that is which has best space complexity and making operations simpler. Other programs on different streams are also being provided which gives best solutions of all making every Datastructure basic concepts quite simpler to move forward with algorithms. Here is a program depicting array’s three largest numbers with one loop. To know resources to learn programming visit best resources to learn programming for free.
Program depicting array’s three largest numbers with one loop.
printf(“enter a number of elements”);
printf(“first largest %d\n”,a);
printf(“no second largest number\n”);
printf(“second largest %d\n”,b);
printf(“no third largest number\n”);
else printf(“third largest %d\n”,c);
The above program runs for numbers excluding duplicates, this is the program of 0(n) complexity and 0(1) space complexity. I hope this would solve the problem.