Category: Blogathon

Cache Memory Performance

Types of Caches :L1 Cache : Cache built in the CPU itself is known as L1 or Level 1 cache. This type of cache holds most recent data so when, the data is required again so the microprocessor inspects this cache first so it does not need to go through main memory or Level 2 […]

Continue Reading

Integrating Django with Reactjs using Django REST Framework

In this article, we will learn the process of communicating between the Django Backend and React js frontend using the Django REST Framework. For the sake of a better understanding of the concept, we will be building a Simple Task Manager and go through the primary concepts for this type of integration between React js […]

Continue Reading

10 Tips and Tricks to Crack Internships and Placements

“All our dreams can come true if we have the courage to pursue them.” – Walt DisneyThe placement season has already started and many of you must be gearing up for placements. However, many of you must be having doubts like what exactly we should prepare, what are the expectations of an interviewer, are placements […]

Continue Reading

10 Interesting APIs to Consider for Projects

API is an acronym for Application Programming Interface. In simple words, we can say that an API delivers a user response to a system and sends the system’s response back to a user. One of the most common examples is weather apps, whenever we search the weather of any specific place the apps do not […]

Continue Reading

Queue Operations

using System;using System.Collections.Generic;public class GFG {     public class Geeks {           public void insert(Queue q, int k)    {                q.Enqueue(k);    }            public int findFrequency(Queue q, int k)    {                int cntFrequency = 0;                int size = q.Count;                while (size– != 0) {                                    int x = q.Peek();            q.Dequeue();                                    if (x == k) {                                cntFrequency++;            }                                    q.Enqueue(x);        }                return cntFrequency;    }}        public static void Main()    {                       Queue q = new Queue();        int N = 8;        int[] a = new int[] { 1, 2, 3, […]

Continue Reading

Check if given array can be rearranged such that mean is equal to median

#include using namespace std;bool binarySearch(float arr[], int size, float key){    int low = 0, high = size – 1, mid;    while (low arr[mid])            low = mid + 1;                        else if (key < arr[mid])            high = mid - 1;                        else            return 1;    }            return 0;}bool twoPointers(float arr[], int N, float mean){    int i = 0, j = N - 1;    while (i < j) {                float temp = […]

Continue Reading

Sum of the shortest distance between all 0s to 1 in given binary string

#include using namespace std;void findTotalDistance(string S, int N){            vector prefixDistance(N);    vector suffixDistance(N);            int cnt = 0;        bool haveOne = false;    for (int i = 0; i < N; ++i) {                if (S[i] == '1') {                        haveOne = true;                        cnt = 0;                        prefixDistance[i] = 0;        }                else if (haveOne) {                        cnt++;                        prefixDistance[i] = cnt;        }                        else            prefixDistance[i] = INT_MAX;    }        haveOne = false;    for (int i = N - 1; i >= 0; –i) {                if […]

Continue Reading

Maximum element in connected component of given node for Q queries

  #include using namespace std;  int Find(vector& parent, int a){    return parent[a] = (parent[a] == a)                           ? a                           : (Find(parent, parent[a]));}  void Union(vector& parent,           vector& rank,           vector& maxValue,           int a, int b){      a = Find(parent, a);    b = Find(parent, b);      if (a == b)        return;          if (rank[a] == rank[b]) {        rank[a]++;    }      if (rank[a] < rank[b]) {        int temp = a;        a = b;        b = temp;    }      parent[b] = a;          maxValue[a] = max(maxValue[a],                      maxValue[b]);}  void findMaxValueOfSet(    vector& arr,    vector& queries, int […]

Continue Reading