A binary tree is a tree in which each node has 1 or 2 child nodes. A node cannot have more than two children in…
A priority queue is like a regular stack or queue data structure, but in addition, each element has a priority associated with it. Elements in…
Download the full code here: [wpdm_package id=’1308′] Suppose you have a graph as shown below. Let us see how we perform breadth first traversal here: Since…
Download the cod here: [wpdm_package id=’1306′] For reversing a singly linked list, you will need a function with 2 pointers (here n and curr). We…
Download the code here: [wpdm_package id=’1301′] Given an array of numbers, to find the subarray which gives the maximum sum can be solved using Kadane’s…
Download the code here: [wpdm_package id=’1296′] #include<stdio.h> //for C file input/output functions #include<stdlib.h.h> //used here for exit() function #include<string.h> //for using strcmp() function #include<sys/types.h> //contains…
Download the code here: [wpdm_package id=’1299′] #include<stdio.h> //for C file input/output functions #include<stdlib.h.h> //used here for exit() function #include<string.h> //for using strcmp() function #include<sys/types.h> //contains…