int searchItr(int key) {
Node* temp = head;
int idx = 0;
while(temp != NULL) {
if(temp->data == key) {
return idx; }
temp = temp->next;
idx++; }
return -1;
}
#include <iostream> using namespace std; struct Node { int data; Node* next; }; class Stack { Node* top; public: Stac...
No comments:
Post a Comment