Skip to content

Instantly share code, notes, and snippets.

View susanhsrestha's full-sized avatar

Susan Shrestha susanhsrestha

View GitHub Profile
@susanhsrestha
susanhsrestha / RecursionReversalOfLinkedList.cpp
Created January 24, 2020 18:19
This is an implemantation of Reversal of a singly linked list using recursion
//Implementation of Linked List and Insertion of Elements
#include<iostream>
using namespace std;
struct Node{
int data; // representation of list
Node* next;
};
struct Node* head;
void display(){
Node* temp = head;
@susanhsrestha
susanhsrestha / ItterativeReversalOfLinkedList.cpp
Created January 24, 2020 18:04
This is an implementation of reversal of a Linked List
//Implementation of Linked List and Insertion of Elements
#include<iostream>
using namespace std;
struct Node{
int data; // representation of list
Node* next;
};
struct Node* head;
void display(){
Node* temp = head;
@susanhsrestha
susanhsrestha / DynamicQueue.cpp
Created January 24, 2020 17:41
This is an implementation of dynamic queue using linked list
#include<iostream>
#include<conio.h>
using namespace std;
struct Node{
int data;
Node* next;
};
Node* front = NULL;
Node* rear = NULL;
void display(){
@susanhsrestha
susanhsrestha / StaticQueue.cpp
Created January 23, 2020 13:31
This is an implementation of static queue ADT
#include<iostream>
#include<conio.h>
#define size 2
using namespace std;
class Queue{
int a[size],front,rear;
public: Queue(){
front = rear = -1;
}
bool isEmpty(){
@susanhsrestha
susanhsrestha / DynamicStackUsingLinkedList.cpp
Created January 23, 2020 13:01
Dynamic Stack ADT operations using C++
#include<iostream>
#include<conio.h>
using namespace std;
struct Node{
int data;
Node *next;
};
struct Node* head = NULL; // empty list creation
void push(int data){
Node* temp = new Node;
@susanhsrestha
susanhsrestha / ArrayImplementationStack.cpp
Created January 23, 2020 12:44
This program implemented in C++ provides the Stack ADT in array implementation.
#include<iostream>
#include<conio.h>
#define size 10
using namespace std;
class Stack{
int a[size], top;
public: Stack(){
top = -1;
}
void push(int x){
@susanhsrestha
susanhsrestha / DeletionInLinkedList.cpp
Last active January 22, 2020 19:00
This program implemented in C++ covers all types of deletion that we can perform in a singly linked list.
//Implementation of Linked List and Insertion of Elements
#include<iostream>
#include<conio.h>
using namespace std;
struct Node{
int data; // representation of list
Node* next;
};
struct Node* head;
void insertAtHead(int x){
@susanhsrestha
susanhsrestha / InsertionInLinkedList.cpp
Created January 22, 2020 16:37
This program is an implementation of Linked List using C++ and it covers all types of insertion in a singly linked list.
//Implementation of Linked List and Insertion of Elements
#include<iostream>
#include<conio.h>
using namespace std;
struct Node{
int data; // representation of list
Node* next;
};
struct Node* head;
void insertAtHead(int x){