Posts

Showing posts with the label Article

Searching and sorting- Linear Search

bool search(int arr[],int size,int key) { for(int i=0;i<n;i++) {       if(arr[i]==key)        {           return 1;        } } return 0; } Time complexity = O(n) space complexity=O(1) Approach: In Linear search, we have given an array, the size of the array, and the key element that we have to find in the array whether the key element is present in the array or not. If the key element is present in an array then return true otherwise return false. Step-1:-Now, make a function for searching the key element and pass the array, size of the array, and key element you want to find. Also return type of function is bool because we just want that key element to be present or not. So, basically, we want if present then True otherwise False and for this, we have to use Bool return type.       bool search(int arr[],int size,int key) {     //code } Step-2: For finding key elements in an array we have to traverse the array from start to its size i.e from 0-->size. So we have to take an int va

What I did in B.Tech 1st year...

Image
From today, I can say myself sophomore as our last exam of 1st year is over now. I still remember, my first day [18-07-19] at GLBITM Greater Noida when I came here with my father for taking admission and settle on the campus. That day was full of excitement and tiring too. On 05-08-2019 my first college day and day by day I have made lots of good friends 100+ (approx) which also includes some seniors. All of my friends are very motivating and supportive in my life. This year I learned many things from making ED sheets to doing workshops . I still remember when I first print “ Hello, World ”     [24-10-19]. Although it was late for me to learn C language though I enjoyed learning this. Later I started to learn basic full stack Web development and I keep practicing this to learn more. Till now I learn C++ Programming language from online videos like code with harry and w3 schools also sometimes from geekforgeeks. This is my fest which we the B.tech 1st year student attend because my coll