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