We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Tag: vs

C++11 Smart Pointer – Part 3: shared_ptr vs Pointer

In this article we will compare C++11 Smart Pointer Implementation shared_ptr and a normal pointer. Let’s compare shared_ptr and raw pointer based on following aspects i.e. Advertisements Missing ++, – – and [] operator In comparison to a raw pointer, shared_ptr provides only these operators 1.) -> , * 2.)  Comparison Operators Frequently Asked: C++11 …

C++11 Smart Pointer – Part 3: shared_ptr vs PointerRead More

Set vs Map : How to choose a right associative container ?

In this article we will discuss how set and map are different and what factors we need to keep in mind while choosing right associative container. Let’s start from set, Set : Advertisements Set is an associative container which we need to store unique elements. It always keeps the elements in sorted order. Internally it …

Set vs Map : How to choose a right associative container ?Read More

deque vs vector : What to choose ?

In this article we will discuss the differences between vector and deque STL Containers. Vector provides insertion and deletion at middle and end only. Whereas, deque provides operations for insertion at front, middle and end. That is, apart from push_back() and pop_back() APIs jus like vector, deque also has push_front() and pop_front() API to add …

deque vs vector : What to choose ?Read More

map vs unordered_map | When to choose one over another ?

In this article we will compare std::map and std::unordered_map and will also discuss when to choose one over another. Both std::map & std::unordered_map store elements in key value pair & provide member functions to efficiently insert, search & delete key value pairs. Advertisements But they are different in following areas, Internal Implementation Memory Usage Time …

map vs unordered_map | When to choose one over another ?Read More

POSIX : Detached vs Joinable threads | pthread_join() & pthread_detach() examples

With every thread some resources are associated like stack and thread local storage etc.  When a thread exits ideally these resources should be reclaimed by process automatically. But that doesn’t happens always. It depends on which mode thread is running. A Thread can run in two modes i.e. Joinable Mode Detached Mode Joinable Thread & pthread_join() …

POSIX : Detached vs Joinable threads | pthread_join() & pthread_detach() examplesRead More

C++ : How to check if a Set contains an element | set::find vs set::count?

In this article we will discuss how to check if a given element exists in set or not. Suppose we have a set of strings i.e. Advertisements // Set of strings std::set<std::string> setOfStrs = { “the”, “is”, “of” , “from” , “at” , “hello” , “the” }; Now we wnat to check if any given …

C++ : How to check if a Set contains an element | set::find vs set::count?Read More

Java : How to update the value of an existing key in HashMap | put() vs replace()

In this article we will discuss different ways to update the value of an existing key in HashMap in Java. Suppose we have a HashMap of words and their frequency count i.e. Advertisements // Create a Map of words and their frequency count HashMap<String, Integer> mapOfWords = new HashMap<String, Integer>() { { put(“John”, 25); put(“at”, …

Java : How to update the value of an existing key in HashMap | put() vs replace()Read More

Python : Sort a List of numbers in Descending or Ascending Order | list.sort() vs sorted()

In this article we will discuss how to sort a list of numbers in ascending and descending order using two different techniques. list.sort() vs sorted() list’s sort() function In Python, list provides a member function sort() that can sorts the calling list in place. Advertisements sorted() Function It’s a built in function that accepts an …

Python : Sort a List of numbers in Descending or Ascending Order | list.sort() vs sorted()Read More

Python : How to add an element in list ? | append() vs extend()

In this article we will discuss how to add element in an existing list using different techniques. Adding item in list using list.append() list.append(item) It adds the item at the end of list. Advertisements For example, we have a list of string i.e. # List of string wordList = [‘hi’, ‘hello’, ‘this’, ‘that’, ‘is’, ‘of’] …

Python : How to add an element in list ? | append() vs extend()Read More

Python : How to remove element from a list by value or Index | remove() vs pop() vs del

In this article we will discuss different ways to remove an elements from list. Remove an element from List by value using list.remove() Python’s list provides a member function to remove an element from list i.e. Advertisements list.remove(value) It removes the first occurrence of given element from the list. For example, Frequently Asked: Convert a …

Python : How to remove element from a list by value or Index | remove() vs pop() vs delRead More

Cart

Your Cart is Empty

Back To Shop