Posts

Showing posts with the label study material

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

BULLYING:-The facts we are not aware of

Image
                      Not all scars are visible, not all wounds heal!!                     #stop bullying                                          Bullying : I t is use of force ,or threat ,to abuse, screaming someone and insulting someone etc. It is also a type of harassment. Harassing someone for their sexual appearance, embarrassing someone in public, using someone and their emotions for own benefits and blaming someone for the things that aren't their fault.       What if I told you suicide was the leading cause of death among young people ? What if I told you over fifty percent of young people experience bullying at some point in their life? What if i told you about 1 in 5 young people has experienced bullying in the past month.                                         Bullying is a behavior that harms or humiliates someone, either physically or emotionally and it happens anywhere while at school, in house an online on social media.    image source- instagram,  by mrbeardman59