• The School
    • Introduction
    • Admissions
    • Academic Calendar 2025
  • Students
    • 1st Term Routine 2025
    • Phase 1 & Mid Term Classes 8, 9 and 10 2024
    • Midterm Routine Class 12 2024
  • Photo Gallery
  • School Events
  • Hostel
  • Higher Secondary (Arts and Science)
  • Little Star Faculty
  • Resources
    • Digital Book Launch by Honourable Chairman LSHSS to Celebrate International Women’s Day
    • Computer Science Class 11
    • Class 1
    • Class 2
    • Class 3
    • Class 4
    • Class 5
    • Class 6
    • Class 7
    • Class 8
    • Class 9
    • Class 10
    • Class 11
    • Class 12

Little Star Hr. Sec. School

Love Truth Service

Linked List in C++

#include <iostream>
using namespace std;
struct node
{
	int data;
	node* next;
};
class link_list
{
	node* first;
	node* last;
	public:
		link_list()
		{
			first=last = NULL;
		}
		~link_list()
		{
       // frees up memory allocated by new
		    node* current = first;
		    node* next;
		
		    while (current != NULL) 
			{
		        next = current->next;
		        delete current;
		        current = next;
		    }
		}		
		bool IsEmpty()
		{
			if(first == NULL)
			  return true;
			else
			  return false;  
		}
		void AddItem(int data)
		{
			node *temp = new node;
			temp->data = data;
			temp->next = NULL;
			if(first == NULL)
			  first = last = temp;
			else
			  last->next = temp;
		  	last = temp;
		}
		void Display()
		{
			node *current = first;
			int i=1;
			while(current!=NULL)
			{
				cout<<i<<" - "<<current->data<<endl;
				current=current->next;
				i++;
			}
		}
};

Recent Posts

  • Topic: Federalism in India: Unity in Diversity Assembly Presentation on 23rd June,2025 
  • Students Shine at Annual Summer Hobby Camp
  • “Maths More Than Just Numbers” Assembly Presentation on 19th May 2025
  • Assembly Presentation on Lessons from Literary Heroes. Dated:-30th April,2025 
  • Assembly Presentation 17th April, 2025

Social Media

  • Instagram : Little Star Hr Sec School
  • Instagram : Star Kids
  • Instagram : Computer Science Dept, Little Star Hr Sec School

Little Star Higher Secondary School

Love Truth Service

Midland, Dimapur
Nagaland

Copyright © 2025 · Education Pro Theme On Genesis Framework · WordPress · Log in