-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
/
cll.h
43 lines (38 loc) · 1.22 KB
/
cll.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Simple data structure CLL (Cicular Linear Linked List)
* */
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <iostream>
#ifndef CLL_H
#define CLL_H
/*The data structure is a linear linked list of integers */
struct node {
int data;
node* next;
};
class cll {
public:
cll(); /* Construct without parameter */
~cll();
void display(); /* Show the list */
/******************************************************
* Useful method for list
*******************************************************/
void insert_front(int new_data); /* Insert a new value at head */
void insert_tail(int new_data); /* Insert a new value at tail */
int get_size(); /* Get total element in list */
bool find_item(int item_to_find); /* Find an item in list */
/******************************************************
* Overloading method for list
*******************************************************/
int operator*(); /* Returns the info contained in head */
/* Overload the pre-increment operator.
The iterator is advanced to the next node. */
void operator++();
protected:
node* head;
int total; /* Total element in a list */
};
#endif