How to get the second largest number by not usings list and max()min()
<p>I want to find the second largest number such as this topic. <a href="http://stackoverflow.com/questions/16225677/get-the-second-largest-number-in-a-list-in-linear-time">Get the second largest number in a list in linear time</a></p>

<p>My problem is this restricting words <code>list</code>, <code>[]</code>, <code>remove</code>, <code>del</code>, <code>min</code>, <code>max</code>, <code>dict</code>, <code>{}</code>, <code>sort</code>, <code>pop</code>.</p>

<p>I have no ideas to get the second largest number. Then, I want someone to suggest me.</p>

<p>Thanks!</p>

<p>Not sure I've understood correctly your question but the <a href="http://stackoverflow.com/questions/16225677/get-the-second-largest-number-in-a-list-in-linear-time">post</a> you've mentioned is giving you already few good solutions. For instance, if you don't want to code the algorithm by yourself, use the standard library <a href="https://docs.python.org/2/library/heapq.html" rel="nofollow">heapq</a> like this:</p>

<pre><code>import random
import heapq

random.seed(1)
el = [random.randint(1, 100) for i in range(20)]
print el
first_max, second_max = heapq.nlargest(2, el)
print "Max element is {0} and the second max {1}".format(first_max,
second_max)
</code></pre>

python