apurva's Site

apurva appu

STACKS -USING A LINKED LIST

The stack operations are push and pop These operations on linked list are "ADD IN THE BEGINNING",and "DELETE IN THE BEGINNING" THE OPERATIONS ARE PUSH AND POP PUSH OPERATION: The operation here is push so we insert new node at the beginning of the li...

STACKS

Definition: The stack is a data structure which follows the principle of LAST IN FIRST OUT Consider data stored in stack be 1 2 3 4 5 6 Let they be inserted one after the other then stack looks like.. 654321The position of 6 is called TOP position.Any...

Program to check whether given strings are anagrams or not

ANAGRAM:Given two strings are said to be anagrams only when they are formed with same characters with characters repeating same number of times. For example: SKILL KILLS Here charactercount in string onecount in string twos11k11i11l22Hence we can say...

program to print patterns

Patterns for a triangle and a 'x' pattern TRIANGLE PATTERN ------* * * * * * * * * * * * * * * This pattern has some generality inumber of starsnumber of spaces114223332441550Two loops are used because there are rows and col...

DELETE OPERATION ON LINKED LIST

The delete operation on linked list can be done in 3 different positions .They are At the beginning In the middle At the end BEGINNING The head pointer need to be moved to the next node, head=head->nextEND use a dummy variable to store the head poi...

SINGLE LINKED LIST

The single list is a structure node with data field and a pointer to struct . node declaration is struct node { int data; struct node *next; };The operations on a single linked list push(int data) delete (int data) print(struct *head ) PUSH operation: ...

LINKED LISTS INTRODUCTION

Linked lists are a user defined data data structures,used to store data and memory is allocated for linked lists dynamically,linked lists can be modified based on user's interest. It is usually modeled as structure with one data field and one address ...

The Hurdle Race-Hackerrank

problem statement: Dan is playing a video game in which his character competes in a hurdle race. Hurdles are of varying heights, and Dan has a maximum height he can jump. There is a magic potion he can take that will increase his maximum height by 1 u...

Divisible Sum Pairs-Hackerrank

Problem statement: Problem can be found in hackerrank follow this to solve the problem https://www.hackerrank.com/challenges/divisible-sum-pairs/problem Explanation: HOW TO SOLVE: use two loops and add each existing pair and check whether the sum i...

Program to display a multiplication table

This looks different ,but this says more about using loops and using loop variables. Print a multiplication table for table 2 ianswer122436485106127148169181020Program code is int i; for(i=10;i>0;i--) printf("%d x %d =%d\n",2,i,2*i);This code prints...