Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 1529 of 2109
How to sort a Vector in descending order using STL in C++?
The problem is to sort a vector in descending order using C++'s Standard Template Library(STL). Sorting in descending order means rearranging the elements of the vector so that the largest elements come first, followed by smaller elements, all the way down to the smallest element at the end of the vector. Let's say we have the following vector of integers: vector v = {4, 2, 9, 1, 7}; We want to sort this vector so that the elements are arranged in descending order: v = {9, 7, 4, 2, 1}; In this article, we will show you how ...
Read MoreHow to sort an Array using STL in C++?
The problem is to sort an array using C++'s Standard Template Library (STL). Sorting an array means rearranging its elements in a specific order. In this case, we aim to sort the elements in both ascending and descending order, using the built-in functionalities of the STL. Let's say we have the following array of integers: int arr[] = {4, 2, 9, 1, 7}; The goal is to sort this array so that the elements are ordered from smallest to largest (ascending) and largest to smallest (descending): Ascending: arr = {1, 2, 4, 7, 9} Descending: arr = {9, 7, ...
Read MoreUnix style pathname pattern expansion in Python (glob)
When working with files in Python, you often need to iterate through a list of files that match specific patterns. The 'glob' module provides a convenient way to accomplish this by using Unix-style pathname pattern expansion. It allows you to search for files based on their names, including wildcards, making managing files in your directory easier. Overview of the glob Module The glob module primarily offers three functions: glob(): Returns a list of files that match the specified pattern. iglob(): Returns an iterator (generator) for the matching files, which can be ...
Read MoreHow to print out the contents of a vector in C++?
Vectors are similar to the dynamic arrays but vectors can resize. They are sequence containers that can change their size according to the insertion or deletion of elements. Containers are the objects which holds the data of same type. Vectors may allocate some extra storage for the future growth of elements in the vector. Its elements are stored in the contiguous memory. The data is entered at the end of vector. In this article, we will show you how to print the contents of a vector in C++. Example Scenario: std::vector vec = {10, 20, 30, 40, 50}; You ...
Read MoreHow to find the maximum element of an Array using STL in C++?
In C++, one common task is to find the largest number in an array. An array is just a collection of values, and sometimes we need to find the highest value in that collection. For example, consider the array: int arr[] = {11, 13, 21, 45, 8}; In this case, the largest element is 45. Similarly, for the array: int arr[] = {1, 9, 2, 5, 7}; The largest number is 9. In this article, we will show you how to find the largest number in an array using different methods in C++, including some built-in features ...
Read MoreMost Asked Problems on Graph Algorithm for Coding Interviews
Graph consists of vertices and edges which is a non-linear data structure. In this article, we will discuss the most common and popular problems of graphs in Data Structures and Algorithms. We are covering basic to advanced-level problems which will help you to learn the whole concept in a structured manner. Here are the graph data structure problems from the basics to the advanced level − Fundamentals Problems Here are the basic problems of Graph Data structure − BFS Implementation DFS Implementation Graph Coloring Graph Representation Minimum Spanning Trees (Kruskal's) Minimum Spanning Trees (Prim's) Print Adjacency List Union-Find Data ...
Read MoreMost Asked String Coding Problems for Programming Interviews
String is the collection of the characters used to represent the text. It is immutable in many languages. This article gives you deep knowledge and exceptional learning about the Strings with good examples. We cover common and trending coding problems on String in Data Structures and Algorithms from the basic to the advanced level. Here is the list of problems that have been asked in programming interviews − Basic Problems Valid Palindrome with Special Characters String Compression (Run-length Encoding) Reverse Words in Sentence Maintaining Spacing ...
Read MoreMost Asked Binary Search Tree Coding Problems in Interviews
Binary Search Tree is a data structure with left and right nodes for organizing and storing the data in a sorted manner. This article provides the best coding problems for clearing the interviews. It covers the best and most unique problems from easy to advanced levels. Its main purpose is to provide a range of problems from Basic to Advanced level. Here are the lists of problems to master the Binary Search Tree in Data Structure and Algorithms − Basic Problems Validate Binary Search Tree (with duplicate values handling) Iterative BST Search and Insertion Lowest Common Ancestor in BST ...
Read MoreTop 50 Searching Problems of DSA for Programming Interviews
Searching Problems in Data Structures and Algorithms is key to finding a specific element in present data. In "Top 50 Searching Coding Problems for Interviews, " we Included key coding tasks on Searching Algorithms. These problems help you to improve your problem-solving skills and prepare for interviews. It will enhance your understanding of searching algorithms. They will also boost your confidence in coding interviews. Let's Master the searching algorithms by tackling the Top Searching Problems from easy to advanced Levels − Easy Problems Search in Row-wise and Column-wise Sorted Matrix Find Peak Element in Mountain Array First Bad Version ...
Read MoreMost Asked Sorting Algorithms for Coding Interviews
Sorting algorithms are the most common and useful programs nowadays. Our “Most Asked Sorting Algorithms for Coding Interviews” covers all the problems topic-wise and includes the industry level and important questions from the interview perspective. he trending problems of sorting algorithms in Data Structures and Algorithms with their examples are given below − Arrays and Sorting Array stores the character in contiguous memory locations for sorting the character or numbers we use the following problem approaches − Two Sum 3Sum Product of Array Except Self Maximum Subarray Merge Intervals Search in a Rotated Array Find Peak Element Missing ...
Read More