All posts by kumpa11random

LinkedList : creation and manipulation

LinkedList is a data structure consisting of a group of nodes .In its simplest form, each node contains a data element and a link or reference  to the next node in the sequence . Because of this structure  insertion or removal of elements from any position in the list becomes very easy.


linkedlist code for creation and list manipulation

Here is the c++ code which can create a link list and allows the user to perform various operations on linked list like  inserting element, delete,reversing the linked list , counting the number of elements etc to manipulate it:


*Program to various operations on linked list of integers
*code tested on devc++ IDE

using namespace std;

struct node
{int data;
node *link;

void add(int NUM)
node *temp,*q;
  {P=new node ;
  temp=new node;

void display()
{node *q;
  cout<data<<"\n";   q=q->link;
void del(int NUM)
{node *q,*prev=NULL;
if(q==NULL)cout<<"\nElement does not exist in the list";
 else   {prev->link=q->link;

void reverse()
{node *q,*temp,*next;
int count()
{int count=0 ;node *q=P;
return count;

int nthfromend(int INDEX)
{node *i,*j,*prev;
int current=0,n=0,len,ifromend;
 {cout<<"invalid INDEX\n";  } else for(i=P;i!=NULL;i=i->link)
  {if(current==ifromend){return i->data;}

node *temp;
{cout<<"Select the operation u want to perform on linked list:\n1.Add Element\n2.Delete Element\n3.Display()\n4.Reverse List\n5.Find nth element from end\n6.Count number of Elements in list\n7.Exit\n\n"; cin>>OPTION;
 case 1:int NUM;
        cout<<"Enter the element to add:\n";         cin>>NUM;
 case 2:
        cout<<"Enter the element to delete:\n";         cin>>NUM;
 case 3:display();
 case 4:reverse();
 case 5:int INDEX;
        cout<<"Enter INDEX:\n";         cin>>INDEX;
        cout<<INDEX<<"th element fomr end"<<nthfromend(INDEX)<<"\n";
 case 6:cout<<"There are "<<count()<<" elments in the list\n";
 case 7:exit(0);
 default:cout<<"u entered invalid option";

Searching Algorithms

Searching is the process of finding a particular item may be string,integer or anything else in a list of items.

These algorithms generally involve the comparison of key with the elements in the list and returning element index in the list if a match occurs. The simplest example is consider a list of elements:

LIST :3 5 10 100 6

suppose we are searching for element 6 in this , so we will start comparing 6 with every element in the list starting from 3 , since 6 is present at position 4 in the array so the above search will return 4. Various searching algorithms exist for different datastructures varying in their runtime and technique they are using for finding match.U can find the details of various searching algorithms under this tab along with their code. So keep reading and keep visiting this page.If u are searching for some code which is not here just mail us we will add it.

Sorting Algorithms

Sorting is the process of arranging or ordering items in some order . As simple as it sounds.

Various sorting algorithms exist for sorting items all of which basically do the same thing  but vary in a number of things like the number of comparisons  done to sort items , extra space  used or whether they are comparing elements for sorting or not comparing them.

We have added or will be adding the c++ code for all popular sorting algorithms under this page.

So whenever u need the code for any sorting algorithm just visit this page .

If u are searching for some code which is not here just mail us we will add it.

Code Library : ready to run codes library

Code Library is an effort by us to provide quality and ready to  run codes  for those searching for it.

U can use these codes for learning purpose or for completing  your assignments quickly when u are busy with some other Hack and not getting time to complete it or may be for incorporating  in some other code .All our codes are thoroughly tested and with outputs.

We are working hard to help u and make this library as big as possible and containing the code for all popular and some non popular but which we know and want u to know algorithms spanning all the types sorting , searching , graphs ,trees , dynamic programming etc.And if you are looking for interview questions visit this site crackdinterview.

So keep visiting this page whenever u require any code , if it’s not there just mail us our team will write it for u.

Lessons for Life

lesson for life

lesson for life

Lessons from life(not a typo) .These are some of the lessons which life has taught me .

I am a believer of the thought that there are no negative and positive experiences there are only lessons which life teaches u in it’s own way. I’m writing these things for myself but you are free to read and learn from the lessons which I’ve learned.

What I want from Life?

I just want to be happy , so if u want that first think and know what happiness means to u.What’s that one thing which makes u happy?Is there something which u can do for ur entire life?Is there anything which if u have achieved u think u will satisfied .Is it money, ur family , travel .. what it is just find it out .As someone said Purpose of Life is Life of Purpose .

Settling For Mediocre 

Don’t ever give up , before achieving what u decided u will.There comes a hell lot of mediocre options just to test u .But don’t settle for those else u will always feel unsatisfied from inside .Strive for the best. Continue reading


Karma VS Destiny : Why should I work ?

Is everything prewritten??

I am also from one of those who think everything is prewritten. Some think it’s written at the time we took birth.But then a strange question comes to my mind ,

Why should I work ?

if every thing is prewritten .Let the events happen the way they are written and just enjoy. Why all this hardwork ? Then what’s the point of living this life like a race ?

I gave this question a good thought , referred some good books , a good number of articles and got an answer which to some extent was satisfactory at least for me .If u are still struggling for the answer read further.

The answer to this question lies in what exactly is prewritten.                                                         Here’s what I understood from reading various stuff .

The Holy Game Analogy

“The way we play board games , Gods are also playing a game . Where pawns are humans and dice is time.They throw the dice of time , now the most important thing they throw the dice of time and the value they get is decided by ur hardwork . The series of short term events that’s happening in ur life is deiced by god.But u can always show ur caliber and in the given time frame and show that u are the strongest player and should be used for some higher goal.” Continue reading