Cll

/*
 * 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
Algerlogo

Β© Alger 2022

About us

We are a group of programmers helping each other build new things, whether it be writing complex encryption programs, or simple ciphers. Our goal is to work together to document and model beautiful, helpful and interesting algorithms using code. We are an open-source community - anyone can contribute. We check each other's work, communicate and collaborate to solve problems. We strive to be welcoming, respectful, yet make sure that our code follows the latest programming guidelines.