Farhan Muhamed

Farhan Muhamed

No Code Developer, Vibe Coder

About

Professional Technical Content Writer, SEO Analyst and Software Developer specialized in web development and DSA in C++, Python.
Drop your queries and messages here: x.com/farhan

101 Articles Published

Articles by Farhan Muhamed

101 articles

Array Manipulation and Sum using C/C++

Farhan Muhamed
Farhan Muhamed
Updated on 15-Mar-2026 3K+ Views

In this problem, you are given an integer array arr of size n and an integer S. Your task is to find an element k in the array such that if all the elements greater than k in the array are replaced with k, then the sum of all the elements of the resultant array becomes equal to S. If such an element exists, print it; otherwise, print -1. Syntax int getElement(int arr[], int n, int S); Algorithm To solve this problem efficiently, we follow these steps − Sort the array in ...

Read More

4 Dimensional Array in C/C++

Farhan Muhamed
Farhan Muhamed
Updated on 15-Mar-2026 1K+ Views

A 4 dimensional array in C is an array of 3 dimensional arrays, where each 3D array contains multiple 2D arrays, and each 2D array contains multiple 1D arrays. This creates a hierarchical structure with four levels of indexing. Syntax datatype array_name[dimension1][dimension2][dimension3][dimension4]; For example: int arr[3][2][3][4]; /* 3 blocks, 2 tables, 3 rows, 4 columns */ Declaration and Initialization You can initialize a 4D array during declaration using nested braces − #include int main() { int arr[2][2][2][3] = { ...

Read More

C/C++ Macro for string concatenation

Farhan Muhamed
Farhan Muhamed
Updated on 15-Mar-2026 5K+ Views

In C programming, macros provide a powerful way to concatenate strings at compile-time using the preprocessor. This technique allows for efficient string manipulation without runtime overhead, making it particularly useful for creating constants, debug messages, and code generation. Syntax /* String literal concatenation */ #define STRING1 "First part" #define STRING2 "Second part" #define CONCATENATED STRING1 STRING2 /* Token concatenation using ## operator */ #define CONCAT_TOKENS(a, b) a##b Understanding Macros in C In C, macros are preprocessor directives defined using #define. They are expanded before compilation, replacing every occurrence with the defined value. Macros ...

Read More

Validate Binary Search Tree in Python

Farhan Muhamed
Farhan Muhamed
Updated on 22-Aug-2025 1K+ Views

A binary search tree is a special binary tree in which for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. In this article, we will discuss how to validate whether a given binary tree is a valid binary search tree (BST) in Python. Validate Binary Search Tree Algorithm to Validate Binary Search Tree Python Program to Validate Binary Search Tree Validate Binary Search Tree Given a root node of ...

Read More

Verify Preorder Sequence in Binary Search Tree in C++

Farhan Muhamed
Farhan Muhamed
Updated on 22-Aug-2025 268 Views

In this article will explain a popular coding problem that involves verifying whether a given preorder sequence can represent a valid binary search tree (BST). We will discuss the problem statement, provide examples, algorithm to solve, and a C++ implementation of the solution. Problem Statement Algorithm to Solve Problem C++ Program Time and Space Complexity Verify Preorder Sequence in Binary Search Tree Given an array containing the preorder traversal of a binary tree, we need to verify whether it ...

Read More

Searching for minimum and maximum values in an Javascript Binary Search Tree

Farhan Muhamed
Farhan Muhamed
Updated on 20-Aug-2025 644 Views

In this article, we will explain how to find the minimum and maximum values in a binary search tree (BST), with implementation in JavaScript. A binary search tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. So the leftmost node will have the minimum value, and the rightmost node will have the maximum value. Find Minimum and Maximum in a BST Given root node of a binary search tree, ...

Read More

Python Program To Find the Smallest and Largest Elements in the Binary Search Tree

Farhan Muhamed
Farhan Muhamed
Updated on 19-Aug-2025 560 Views

In this article, we will explain how to find the minimum and maximum values in a binary search tree (BST), with implementation in Python. A binary search tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. So the leftmost node will have the minimum value, and the rightmost node will have the maximum value. Find Minimum and Maximum in a BST Given root node of a binary search tree, ...

Read More

Program to convert binary search tree to a singly linked list in C++?

Farhan Muhamed
Farhan Muhamed
Updated on 19-Aug-2025 724 Views

A Binary Search Tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. In this article, we will discuss how to convert a Binary Search Tree (BST) into a singly linked list in C++. Flatten Binary Search Tree to Singly Linked List Given a Binary Search Tree, the goal is to convert it into a singly linked list where the linked list nodes are in the same order as the in-order ...

Read More

Print Common Nodes in Two Binary Search Trees in C++

Farhan Muhamed
Farhan Muhamed
Updated on 18-Aug-2025 340 Views

A Binary Search Tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. In this article, we will solve the problem of finding common nodes in two binary search trees (BSTs). Find Common Nodes in BSTs In this problem, you are given two binary search trees (BSTs) and your task is to develop a program that finds all the common nodes between these two trees. In the other words, the intersection ...

Read More

Print all odd nodes of Binary Search Tree in C++

Farhan Muhamed
Farhan Muhamed
Updated on 18-Aug-2025 358 Views

A Binary Search Tree is a data structure that stores data in a sorted order such that for every node, the left subtree contains values less than the node's value, and the right subtree contains values greater than the node's value. In this article, we will solve the problem of finding all odd nodes of a binary search tree in C++. Find Odd-Valued Nodes in BST You are given a binary search tree (BST) as input and your task is to write a program that finds all the nodes with odd values and returns them as output. To understand ...

Read More
Showing 1–10 of 101 articles
« Prev 1 2 3 4 5 11 Next »
Advertisements