Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Server Side Programming Articles - Page 2316 of 2650
452 Views
A multimap is an associative container that stores elements in a key-value pair format, where multiple values can share the same key. In this article, we will learn how to use a multimap from the Standard Template Library (STL) in C++. What is Multimap? Multimap is a sorted associative container that stores data in key-value pairs, where keys can occur multiple times. Keys are stored in sorted order, and you can insert, access, and remove elements based on the key. For example, in a multimap we can store student names with their scores even if some students have ... Read More
4K+ Views
A map is an associative container that stores elements in a key-value pair format. Each element has a unique key and a corresponding mapped value. No two mapped values can have the same key. In this article, we will learn how to use a map from the Standard Template Library (STL) in C++. What is Map? Map is a sorted associative container that contains key-value pairs with unique keys. Keys are sorted automatically, and each key is associated with a value. You can insert, access, and remove elements based on the key. For example, we can store ... Read More
423 Views
A List in C++ STL library is hardcoded implementation of a doubly linked list data structure. In this article, we will learn how to implement and use a list in C++ . What is List? List is a doubly linked container provided in the C++ STL library, in which each element points to both its previous and next elements. Meaning, in this list we can quickly traverse in both forward and backward direction using pointers just like a doubly linked list. Compared to vectors or arrays, these lists allow fast insertions and deletions from the middle of the sequence. ... Read More
279 Views
Forward List is a type of singly linked list available in the C++ STL (Standard Template Library). In this artcile, we will learn how to use forward_list from C++ STL library. What is Forward List? Forward list is a linear data structure which allows traversal only in one direction. It is similar to a singly linked list where each element points to the next element and moves in forward direction. It supports operations like insertion, deletion, and traversal from the beginning to end but not in reverse direction. The insertion and deletion operations are comparatively very fast in ... Read More
455 Views
Deque or Double Ended Queue is a special type of queue where we can insert and delete elements from both front and back. In this article, we will learn how to use deque from C++ STL (Standard Template Library). What is Deque? Deque is a linear data structure in which the insertion and deletion operations can be performed at both the ends (front and rear). Meaning, the data can be inserted at both front and rear positions and can be deleted from both front and rear positions. This gives more flexibility compared to a normal queue which supports only ... Read More
1K+ Views
Binary search is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the sorted array. The time complexity of binary search is O(1). This is a C++ program in which we implement various. Binary Search functions in C++ STLAlgorithmBegin Initialize the vector of integer values. The functions are used here: binary_search(start_pointer, end_pointer, value) = Returns true if the value present in array otherwise false. lower_bound(start_pointer, end_pointer, value) = Returns pointer to “position of value” if container ... Read More
1K+ Views
In this program, we need to find sum of array elements using pointer arithmetic.Here we use * which denotes the value stored at the memory address and this address will remain stored in the variable. Thus “int *ptr” means, ptr is a variable which contains an address and content of the address is an integer quantity.*p means it is a pointer variable. Using this and sum() we will find out sum of the elements of array.Example Code#include void s(int* a, int len) { int i, s_of_arr = 0; for (i = 0; i
1K+ Views
4 Dimensional ArrayThe 4 dimensional array is an array of 3 dimensional arrays. Each 3 dimensional array is an array of 2 dimensional arrays and each 2 dimensional array is an array of 1 dimensional arrays. In this article, we will learn all about 4 dimensional arrays, how to create them and how to access their elements with examples in both C and C++. Syntax to Create a 4D Array Following is the syntax for declaring a 4 dimensional array in C/C++: datatype array_name[dimension1][dimension2][dimension3][dimension4]; // Example int arr[3][2][3][4]; Example of a 4 Dimensional Array The ... Read More
771 Views
As Array index starts with 0, so a[i] can be implemented as *(a + i).If Array index starts with 1 then a[i] will be implemented as *(a+i-1) which will be time consuming during compilation and the performance of the program will also be effected.So, it is better to start index of the array from 0.A simple program of array is given -Example Codeint main() { int array[5] = {7, 7, 7, 6, 6}; for (int i = 0; i < 5; i++) cout
467 Views
Pointers and array most of the time are treated as same in c. Some differences are:&operator:&pointer = returns the address of pointer.&array = returns the address of first element.sizeof operator:sizeof(array) = returns the total memory consumed by the all the elements of the array.sizeof(pointer) = returns the only memory consumed by the pointer variable itself.Array variable can’t be re-assigned a value whereas pointer variable can.Declaration:int a[]; //array Int *p; //pointerLet us consider that there is an integer pointer variableint *i;Now let us consider the outcome of the following assignments –a = &i; //illegal assignment. a variable can not be updated ... Read More