Understanding stack data structure

Stack is a collection of objects where objects are inserted and removed in the Last-In-First-Out order. Element inserted at the end will be deleted first. It is […]

Array implementation of Stack

A better implementation of Stack is usually using linked list unless you are sure of the number of elements in array. But if you are just starting […]

Linked List Implementation of Stack in C++

Write a class which will implement the Stack data structure in C++. Give the declaration & definition of the class. Also define the Node. For […]

Insertion Sort

Insertion sort is the most common sorting technique used by card players to sort their cards. It sorts the array in-place and is the one […]

Selection Sort

Selection sort is an in-place, comparison sorting algorithm. Like bubble sort it also divides the given array in two sub arrays sorted and unsorted, divided by […]

Optimized bubble sort algorithm

What is Bubble Sort. Write algorithm of mention the Time & Space complexity of the Algorithm. Also suggest improvements which will improve the best case […]

Binary Search or Half-interval search

Binary search is a Divide & Conquer algorithm used to search for an element in the array. It requires the array to be sorted. If […]

Linear Search in detail

Linear search or Sequential search is a method for finding a particular value in a linear list of values (Array or Linked List). It is done […]

Check if all leaf nodes are at the same level

Given a binary tree write a function to check if all leaf nodes of the tree are at the same level. For example, In all […]

Check if a Binary Tree is Complete Binary Tree

A Complete Binary Tree is a Binary Tree where each level is completely filled. For example, all the trees below are complete Binary trees Height=1 […]