Which Of The Following Correctly Represents The Function To #1759
Which of the following correctly represents the function to insert elements at the bottom of stack?
This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Recursion - Stack Reversal using Recursion - Quiz No.1.
Which of the following correctly represents the function to insert elements at the bottom of stack?
int BottomInsert(int x) { if(s.size()!=0) s.push(x); else { int a = s.top(); s.pop(); BottomInsert(x); s.push(a); } }
int BottomInsert(int x) { if(s.size()==0) s.push(x); else { int a = s.top(); s.pop(); s.push(a); BottomInsert(x); } }
int BottomInsert(int x) { if(s.size()==0) s.push(x); else { int a = s.top(); s.pop(); BottomInsert(x); s.push(a); } }
int BottomInsert(int x) { if(s.size()==0) s.push(x); else { s.pop(); int a = s.top(); BottomInsert(x); s.push(a); } }
Similar question(s) are as followings:
Online Quizzes of gs122 Data Communication and Computer Network
Sorting - Insertion Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - Insertion Sort - Quiz No.3
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - LSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.1
gs gs122 Data Communication and Computer Network
Online Quizzes
Sorting - MSD Radix Sort - Quiz No.2
gs gs122 Data Communication and Computer Network
Online Quizzes