We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: an

Create a Singly Linked List from an array

Singly Linked List

Suppose we have an int array and we want to create it into a singly linked list from it. Singly Linked List Our Node structure is, Advertisements struct node {     int value;     node * nextPtr;         node(int val)     {         value = val;         nextPtr = NULL;        …

Create a Singly Linked List from an arrayRead More

Using STL to verify brackets or parentheses combination in an expression

In this we will see how to check if a given string take valid combination of open and close brackets i.e. (4+{8-[22+8]*}] contains valid order of open and close brackets. ({5+8]) contains invalid combination of open and close brackets. Advertisements [showads ad=inside_post] Bracket combinations to be used, Frequently Asked: Using STL to verify brackets or parentheses combination in an …

Using STL to verify brackets or parentheses combination in an expressionRead More

Remove all occurences of an element from vector in O(n) complexity

Suppose we have a vector of integers and we want to delete all occurences of a number from it i.e. Let’s say vector contain following numbers 1,2,5,4,5,1,5,7,8,9. Now we want to delete all the occurences of 5 from it, so that vector contents should become – 1 2 4 1 7 8 9 . Also …

Remove all occurences of an element from vector in O(n) complexityRead More

Initializing a HashSet from an Array or a Collection

In this Article we will discuss how to initialize a HashSet using a Array or a Collection. HashSet has a Constructor that receives a Collection as an argument and initializes the new Set with the elements of passed collection object. Advertisements public HashSet(Collection<? extends E> c) Initializing a HashSet with an array Suppose we need to …

Initializing a HashSet from an Array or a CollectionRead More

Cart

Your Cart is Empty

Back To Shop