Write a C program to find largest of three numbers using ternary operator. Given three input numbers, we have to write a code to find largest of three numbers using ternary operator.
CProgrammingCode.com is a programming blog where you learn how to code and data structure through our tutorials.
Search
Program to Print Hello World without using Semicolon - C, C++ Code
Write a C, C++ program to print hello world without using semicolon. In this tutorial, we are going to write a program which will print hello world using if-else, while and switch statements.
In c, c++ programming language every line ends with a semicolon, so it seems tricky how do you use printf in C and cout in C++ without semicolon.
In c, c++ programming language every line ends with a semicolon, so it seems tricky how do you use printf in C and cout in C++ without semicolon.
Binary Search Program Using Recursion in C, C++
Write a C, C++ code to implement binary search program using recursion.
What is Binary Search?
Binary Search algorithm is used to search an element in a sorted array. Binary search works by comparing the value to the middle element of an array. If the value is found then index is returned otherwise the steps is repeated until the value is found.
It is faster than linear search.
Time complexity of Linear search is O(n).
Time complexity of Binary search is O(log(n)).
What is Binary Search?
Binary Search algorithm is used to search an element in a sorted array. Binary search works by comparing the value to the middle element of an array. If the value is found then index is returned otherwise the steps is repeated until the value is found.
It is faster than linear search.
Time complexity of Linear search is O(n).
Time complexity of Binary search is O(log(n)).
C Program to Implement a Stack Using Array
Write a C program to implement a stack using array. In this tutorial, You are going to learn the implement of stack data structure using an array.
What is a Stack Data Structure?
A Stack is a data structure in which insertion and deletion can be done from one end only. That's why it is also called LIFO(Last In First Out).
In stack, Insertion and deletion operation is known as push (Insertion) and pop (Deletion). While inserting and deleting an element in a stack we need to check some conditions.
For insertion, we need to check whether a memory is available, if memory is not available then it is known as stack overflow. Similarly, while deleting (pop operation) an element, if no element is present in a stack, then it is known as stack underflow.
What is a Stack Data Structure?
A Stack is a data structure in which insertion and deletion can be done from one end only. That's why it is also called LIFO(Last In First Out).
In stack, Insertion and deletion operation is known as push (Insertion) and pop (Deletion). While inserting and deleting an element in a stack we need to check some conditions.
For insertion, we need to check whether a memory is available, if memory is not available then it is known as stack overflow. Similarly, while deleting (pop operation) an element, if no element is present in a stack, then it is known as stack underflow.
Subscribe to:
Posts (Atom)
