Posts

Basics

Comment -  for In-line comment (means comment in same line) --> Use //                          for multi-line comment --> Use /* ........ */ Array -  int arr[10] = {4, 5, 8} --> creates array of size 10 with first 3 elements known  Access - 10[arr] or arr[10]  --> both correct bcz *(10+arr) and *(arr+10) are same Pair -  pair<int,string> p  = {2 , "fsf"} How to access ? p.first and p.second Vector -  array with dynamic memory size =>  continuous memory allocation How to  initialize vector ? vector <double> v(10) => declares vector of size 10 with each value as 0 vector <double> v(7 , 3) => declares vector of size 7 with each value as 3 vector <double> v = {1, 3, 5, 10} => declares vector of with given values vector <double> v(st.begin(), st.end()) => declares vector from given set vector <int> v1 =v  ...

File Handling

BENEFITS  OF  FILE  HANDLING give permanent storage facility can access huge chunk of data in instant (bcz RAM is of small size -> can't store huge data) easy to transfer data as files

Stack + Queue + Priority queue

                                                                 STACK //while pushing top++ and while pop top-- in full stack TOP=Max-1 and empty stack ->top = -1 Stack is full and we are pushing => overflow Stack is empty and we are popping => underflow                                                              QUEUE empty queue -> front = - 1  and rear = - 1 if inserted ,i.e., enqueue => rear++ if deleted ,i.e., dequeue => front++ {NOTE:- front is index before first element} eg .- _523 =>front is 0 bcz 1st element '5' is at index 1              ...