DATA STRUCTURE PEP PRACTICE : Data Structure is a way to store and organize data so that it can be used efficiently . For example, we can store a list of items using array,linked list,stack,queue,tree,graph. 1. Array : In this topic we will learn = > --->Array Insertion --->Array Deletion --->Array Rotation Array Insertion #include<iostream> using namespace std; int main() { int a[50],size,num,pos; cin>>size; if(size>50) { cout<<"overflow!!"<<endl; }else { for(int i=0;i<size;i++) { cin>>a[i]; } cin>>num>>pos; for(int i=size-1;i>=pos-1;i--) { a[i+1]=a[i]; } a[pos-1]=num; size++; for(int i=0;i<size;i++) { cout<<a[i]<<" "; } } } -----------------------------------------C omplexity(worst case) : O(n) --------------
Csenotes official blog help for Computer Science Student. This is a blog about Providing Lpu Notes,PPTs ,Question Papers,Codes ,Projects, Hand Written Notes ,Books ,PDF,MCQs Questions,It is strictly According to the syllabus of Lovely Professional University .It is for all students who are studying B.Tech and for others also college students .Computer Science Notes are available here on this site.Csenotes12 .This is Best Computer Science Blog :)