An Interesting Method to generate Binary Numbers from 1 to n

Problem Statement The problem “An Interesting Method to generate Binary Numbers from 1 to n” states that you are given a number n, print all the numbers from 1 to n in binary form. Examples 3 1 10 11   6 1 10 11 100 101 110 Algorithm The generation …

Read moreAn Interesting Method to generate Binary Numbers from 1 to n

Divisible Pairs Counting

Divisible Pairs is one of the interviewer’s favorite problem. This problem is good enough for testing interviewees’ problem skills along with knowledge on topics like arrays and hash-maps. Problem Statement: We have been provided with a selection of distinct positive integers. What to find? The number of pairs such that …

Read moreDivisible Pairs Counting

Priority Queue Using Singly Linked List

In priority queue using a singly linked list problem, we need to implement a priority queue by using a singly linked list. A priority queue contains the following operations, push(x, p): Add an element x with priority p at an appropriate position in the priority queue. pop(): Remove and return …

Read morePriority Queue Using Singly Linked List