Recently Added

Enqueue and dequeue in queue

KRISHNA

 #include <stdio.h>

#include <stdlib.h>


#define MAX 100


int queue[MAX];

int front = -1, rear = -1;


void enqueue(int value) {

    if (rear == MAX - 1) {

        printf("Queue Overflow\n");

        return;

    }

    if (front == -1) {

        front = 0;

    }

    queue[++rear] = value;

}


int dequeue() {

    if (front == -1 || front > rear) {

        printf("Queue Underflow\n");

        return -1;

    }

    return queue[front++];

}


int main() {

    enqueue(10);

    enqueue(20);

    enqueue(30);


    printf("%d dequeued from queue\n", dequeue());

    printf("%d dequeued from queue\n", dequeue());

    printf("%d dequeued from queue\n", dequeue());


    return 0;

}

Insert at beginning in Linked list

KRISHNA

 #include <stdio.h>

#include <stdlib.h>


struct Node {

    int data;

    struct Node* next;

};


void insertAtBeginning(struct Node** head, int value) {

    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));

    newNode->data = value;

    newNode->next = *head;

    *head = newNode;

}


void printList(struct Node* head) {

    while (head != NULL) {

        printf("%d -> ", head->data);

        head = head->next;

    }

    printf("NULL\n");

}


int main() {

    struct Node* head = NULL;


    insertAtBeginning(&head, 10);

    insertAtBeginning(&head, 20);

    insertAtBeginning(&head, 30);


    printList(head);


    return 0;

}

Adding new element in linked list at the end.

KRISHNA

 #include <stdio.h>

#include <stdlib.h>


struct Node {

    int data;

    struct Node* next;

};


void insertAtEnd(struct Node** head, int value) {

    struct Node* newNode = (struct Node*)malloc(sizeof(struct Node));

    newNode->data = value;

    newNode->next = NULL;


    if (*head == NULL) {

        *head = newNode;

        return;

    }


    struct Node* temp = *head;

    while (temp->next != NULL) {

        temp = temp->next;

    }

    temp->next = newNode;

}


void printList(struct Node* head) {

    while (head != NULL) {

        printf("%d -> ", head->data);

        head = head->next;

    }

    printf("NULL\n");

}


int main() {

    struct Node* head = NULL;


    insertAtEnd(&head, 10);

    insertAtEnd(&head, 20);

    insertAtEnd(&head, 30);


    printList(head);


    return 0;

}

Our Team

  • REHMAAN BHAICR
  • Krishna Kumar UpadhyaySite Managment
  • Vikrant SinghPhysical Supporter
  • Vikash PatelIdeas and Visuals
  • Utkarsh SharmaData Supporter
  • Prashant SinghEconomical Supporter