Posts

Showing posts with the label BSc Sem 2 Computer

BCA Semester 2 March 2018 Data Structure Paper

Image

BSc Semester 2 Computer Data Structure Question Bank

B. Sc. Semester 2  Computer   Data Structure   Question Bank C hapter-1 What is pointer? How to declare pointer, explain with example. What is array? Explain types of array with example. What is dynamic memory allocation? Explain dynamic memory allocation functions. Explain sparse matrix. What is Data Structure? Explain types of data structure. Chapter-2 & 3 What is Queue? Explain types of Queue. Write a program to perform insert, delete and display operations on simple queue. What is stack? Write program of stack. Explain circular queue with example. Difference between Stack and Queue. Explain evaluation of express using stack. What is linked list? Explain in detail. Write a program for Singly Linked List. Write a program for Doubly Linked List. Singly linked list v/s doubly linked list. Explain circular linked list with example. Chapter-4 Explain B-tree with example. Write a short ...

B.C.A. Semester 2 Data Structure Paper March/April 2017

Image

Singly and Doubly Link List C Program

Link List Program Singly Linked List /* * File     : SLL.C * Author   : Piyush Patel * Purpose  : Singly Linked List Data Structure Using C Language * Copyright: Shree Matrumandir College */ #include <stdio.h> #include <stdlib.h> typedef struct node {     int data;     struct node* next; } node; typedef void (*callback)(node* data); /*     create a new node     initialize the data and next field     return the newly created node */ node* create(int data,node* next) {     node* new_node = (node*)malloc(sizeof(node));     if(new_node == NULL)     {         printf("Error creating a new node.\n");         exit(0);     }     new_node->data = data;     new_node->next = next;     return new_node; } //add a new node at the beginning of the list ...

Stack and Queue Introduction

Image
Stack A stack is a basic data structure that can be logically thought as linear structure represented by a real physical stack or pile, a structure where insertion and deletion of items takes place at one end called top of the stack. The basic concept can be illustrated by thinking of your data set as a stack of plates or books where you can only take the top item off the stack in order to remove things from it. This structure is used all throughout programming. The basic implementation of a stack is also called a LIFO (Last In First Out) to demonstrate the way it accesses data, since as we will see there are various variations of stack implementations. There are many real life examples of stack. Consider the simple example of plates stacked over one another in canteen. The plate which is at the top is the first one to be removed, i.e. the plate which has been placed at the bottommost position remains in the stack for the longest period of time. So, it can be simply seen to ...

Linked List and Its Operations

Image
Linked List In a game of Treasure Hunt, you start by looking for the first clue. When you find it, instead of having the treasure, it has the location of the next clue and so on. You keep following the clues until you get to the treasure. A linked list is similar. It is a series of connected "nodes" that contains the "address" of the next node. Each node can store a data point which may be a number, a string or any other type of data. Linked lists are the best and simplest example of a dynamic data structure that uses pointers for its implementation. However, understanding pointers is crucial to understanding how linked lists work and you must also be familiar with dynamic memory allocation and structures. Essentially, linked lists function as an array that can grow and shrink as needed, from any point in the array. Linked lists have a few advantages over arrays: 1.    Items can be added or removed from the middle of the list 2.   ...