| 14 | } |
| 15 | } *head = NULL, *tail = NULL; |
| 16 | void create() |
| 17 | { |
| 18 | int n; |
| 19 | cout << "Enter number of nodes. "; |
| 20 | cin >> n; |
| 21 | for (int i = 0; i < n; i++) |
| 22 | { |
| 23 | int x; |
| 24 | cout << "Enter the value of element " << i + 1 << " "; |
| 25 | cin >> x; |
| 26 | node *cur = new node(x); |
| 27 | if (head == NULL) |
| 28 | { |
| 29 | head = tail = cur; |
| 30 | } |
| 31 | else |
| 32 | { |
| 33 | cur->prev = tail; |
| 34 | tail->next = cur; |
| 35 | tail = cur; |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | int cnoe(node *head) |
| 40 | { |
| 41 | int count = 0; |