Found 26504 Articles for Server Side Programming

Unique Binary Search Trees in C++

Farhan Muhamed
Updated on 19-Aug-2025 17:27:24

252 Views

The Unique Binary Search Trees problem is a classic dynamic programming problem that counts the number of unique binary search tree (BSTs) that can be formed with a given number of nodes. In this article, we will explain the problem, testcases, its solution, and provide a C++ implementation. Number of Unique BSTs In this problem, we are given an integer n, which represents the number of nodes in a binary search tree. The task is to find the number of different BSTs that can be formed using these n nodes and return the count. To understand the problem better, ... Read More

Unique Binary Search Trees II in C++

Arnab Chakraborty
Updated on 28-Apr-2020 11:21:10

421 Views

Suppose we have an integer n, we have to generate all structurally unique binary search trees that store values from 1 to n. So if the input is 3, then the trees will be −To solve this, we will follow these steps −Define one recursive function called generate(), this will take low and highdefine one tree node called temp.if low > high, then insert null into the temp, and return tempfor i in range low to highleft_subtree := generate(low, i – 1)right_subtree := generate(i + 1, high)current := ifor j in range 0 to size of the left_subtreefor k in ... Read More

deque_insert( ) in C++ in STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:24:12

708 Views

Given is the task to show the functionality of Deque insert( ) function in C++ STLWhat is Deque?Deque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

List::clear() in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:18:36

4K+ Views

In this article we will be discussing the working, syntax and examples of list::clear() function in C++.What is a List in STL?List is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is clea()?list::clear() ... Read More

List remove() function in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:15:04

13K+ Views

In this article we will be discussing the working, syntax and examples of remove() function in C++.What is a List in STLList is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is remove()remove() ... Read More

deque_rend( ) in C++ in STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:10:39

185 Views

Given is the task to show the functionality of Deque rend( ) function in C++ STLWhat is Deque?Deque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

deque_rbegin( ) in C++ in STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:06:59

148 Views

Given is the task to show the functionality of Deque rbegin( ) function in C++ STLWhat is Deque?Deque is the Double Ended Queues that are the sequence containers which provides the functionality of expansion and contraction on both the ends. A queue data structure allow user to insert data only at the END and delete data from the FRONT. Let’s take the analogy of queues at bus stops where the person can be inserted to a queue from the END only and the person standing in the FRONT is the first to be removed whereas in Double ended queue the ... Read More

List pop_front() function in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 12:02:50

4K+ Views

In this article we will be discussing the working, syntax and examples of pop_front () function in C++.What is a List in STLList is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is ... Read More

List push_back() function in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 11:59:05

2K+ Views

In this article we will be discussing the working, syntax and examples of list:: push_back() function in C++.What is a List in STLList is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is ... Read More

List resize() function in C++ STL

Sunidhi Bansal
Updated on 26-Feb-2020 11:56:34

295 Views

In this article we will be discussing the working, syntax and examples of list::resize() function in C++.What is a List in STLList is a data structure that allows constant time insertion and deletion anywhere in sequence. Lists are implemented as doubly linked lists. Lists allow non-contiguous memory allocation. List perform better insertion extraction and moving of element in any position in container than array, vector and deque. In List the direct access to the element is slow and list is similar to forward_list, but forward list objects are single linked lists and they can only be iterated forwards.What is list::resize()?list::resize() ... Read More

Advertisements