Language Selection

English French German Italian Portuguese Spanish

LinuxHint's Latest C++ Tutorials

Filed under
Development
  • Heap Sort C++

    As we know that the C++ language has a lot of sorting algorithms for sorting array-like structures. One of those sorting techniques is the Heap sort. It is quite popular among C++ developers because it is considered to be the most efficient when it comes to its working. It is a little different from other sorting techniques because it requires the information of data structure trees along with the concept of arrays. If you have heard and learned about binary trees, then learning Heap sort will be no more a problem for you.

    Within heap sort, two types of heaps can be generated, i.e., min-heap and max-heap. The max-heap will sort the binary tree in descending order, while the min-heap will sort the binary tree in ascending order. In other words, the heap will be “max” when the parent node of a child is greater in value and vice versa. So, we have decided to write this article for all those naïve users of C++ who have no prior knowledge about sorting, especially the heap sort.

    Let’s start our today’s tutorial with the Ubuntu 20.04 login to get access to the Linux system. After the login, make use of the shortcut “Ctrl+Alt+T” or the activity area to open its console application named “Terminal.” We have to utilize the console for making a file for implementation. The command for the creation is a simple one-word “touch” instruction following the new name for a file to be created. We have been naming our c++ file as “heap.cc”. After the file creation, you need to start implementing the codes in it. For that, you have to open it first through some Linux editors. There are three built-in editors of Linux that can be used for this purpose, i.e., nano, vim, and text. We are using the “Gnu Nano” editor.

  • Binary Search Tree C++

    BST is a data structure that maintains the data in a sorted list. It is known as a binary search tree because, in the tree, every node has a two children maximum that cannot be increased further. This is known as a search tree because it is used to search or find any item present. We will implement this phenomenon in the C++ language.

  • Difftime function in C++

    While calculating or performing any operation, we might need any function to calculate the total time that has passed until now or provide the difference of time in seconds between two points. In C++, there can be different ways to perform this task inappropriately. But we will discuss the built-in function of C++, that is difftime() function, As the name indicates that it calculates the difference in time. This function is defined in the library . So whenever we are willing to calculate time, we will need this library in the source code.

  • Char array to string C++

    Both Character arrays and strings, in C++, are used to store characters and letters. But there is a difference in them; this can be related by describing them as follows:

  • How to Use the C++ Memcpy Function

    In programming languages, while creating some logical modules for our programs, we need to copy our content from one array of any data type to another array. This duplication may be of the whole array or can be customized by providing a specified size up to which we need to copy the content of the array. This phenomenon can be done through different approaches. Among them is a function in the C++ programming language “memcpy”. This is used to copy the memory in the form of blocks.

  • C++ Convert Int to String

    The conversion of data into two data types is a common phenomenon in the C++ programming language. Similarly, the conversion of integer-type data into the string is described in this guide. Both data types can be converted in several ways.

    The integer data type is a simple type of variable that stores the data only in the form of variables. There are no specified functions that are applied only to the integers. Whereas the string is a data type that has several functions by default that are applied to them. Strings store data in the form of inverted commas. We have converted integer and float values in the string by using one of its built-in functions. For strings, it is mandatory to use a string library.

  • Bucket sort C++

    This is the type of sorting that divides data into more buckets to ease the process of sorting as a whole. The bucket sorting is also known as a scatter-gather approach. Let us start with a simple algorithm to demonstrate the working of bucket sort.

  • Implementing Hash Table in C++

    If you have ever worked in a python environment, then you must have known about the usage of the object “dictionary” that contains a key-value pair within it. Just like dictionaries, C++ came up with the concept of key-value pair. This pair will be stored in the data structure hash table of C++. The data structure hash table will be using the hash function to calculate the array index to insert values into the table using indexes and search them as well.
    Within this guide, we will discuss the use of methods to create, add, delete, search values from the hash tables using some of its functions.

    Let’s start with the login from Linux. Try making a C++ file using the “touch” instruction in the shell and make use of any available built-in editor from your Linux system to open it (i.e. Gnu Nano).

  • C++ Cmath Library

    C++ programming language supports many mathematical functions. Instead of focusing on the implementation of large source codes, these built-in functions are used directly to avoid space and time consumption, hence simplifying the code and program. C++ has a large set of categories of these default functions. These functions are present in the header file of mathematics that must be included while using any C++ math operation.

  • Check for palindrome C++

    We usually use strings in our programs by applying different operations to them. Sometimes such a situation occurs when there is a need to get the resultant value in the reverse order. The same letters in the string with the reverse order are known as a ‘palindrome’. In C++, there are several ways to check if the string or numeric values are palindromes. In this guide, we have used three different approaches to check the status of the string.

  • Fmod( ) Function C++

    In general, to calculate a remainder from two values, we simply divide them manually or often use a calculator to make it. But if we talk about the calculations in the programming languages, some built-in functions are responsible for calculating remainders, fractional values. C++ programming language also contains default functions regarding time, dates, and other mathematical operations. Fmod() function is one of the mathematical operations performed by having two values of the same or different data types. This tutorial will cover the description of the fmod() function and examples of implementation.

More in Tux Machines

digiKam 7.7.0 is released

After three months of active maintenance and another bug triage, the digiKam team is proud to present version 7.7.0 of its open source digital photo manager. See below the list of most important features coming with this release. Read more

Dilution and Misuse of the "Linux" Brand

Samsung, Red Hat to Work on Linux Drivers for Future Tech

The metaverse is expected to uproot system design as we know it, and Samsung is one of many hardware vendors re-imagining data center infrastructure in preparation for a parallel 3D world. Samsung is working on new memory technologies that provide faster bandwidth inside hardware for data to travel between CPUs, storage and other computing resources. The company also announced it was partnering with Red Hat to ensure these technologies have Linux compatibility. Read more

today's howtos

  • How to install go1.19beta on Ubuntu 22.04 – NextGenTips

    In this tutorial, we are going to explore how to install go on Ubuntu 22.04 Golang is an open-source programming language that is easy to learn and use. It is built-in concurrency and has a robust standard library. It is reliable, builds fast, and efficient software that scales fast. Its concurrency mechanisms make it easy to write programs that get the most out of multicore and networked machines, while its novel-type systems enable flexible and modular program constructions. Go compiles quickly to machine code and has the convenience of garbage collection and the power of run-time reflection. In this guide, we are going to learn how to install golang 1.19beta on Ubuntu 22.04. Go 1.19beta1 is not yet released. There is so much work in progress with all the documentation.

  • molecule test: failed to connect to bus in systemd container - openQA bites

    Ansible Molecule is a project to help you test your ansible roles. I’m using molecule for automatically testing the ansible roles of geekoops.

  • How To Install MongoDB on AlmaLinux 9 - idroot

    In this tutorial, we will show you how to install MongoDB on AlmaLinux 9. For those of you who didn’t know, MongoDB is a high-performance, highly scalable document-oriented NoSQL database. Unlike in SQL databases where data is stored in rows and columns inside tables, in MongoDB, data is structured in JSON-like format inside records which are referred to as documents. The open-source attribute of MongoDB as a database software makes it an ideal candidate for almost any database-related project. This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the MongoDB NoSQL database on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux.

  • An introduction (and how-to) to Plugin Loader for the Steam Deck. - Invidious
  • Self-host a Ghost Blog With Traefik

    Ghost is a very popular open-source content management system. Started as an alternative to WordPress and it went on to become an alternative to Substack by focusing on membership and newsletter. The creators of Ghost offer managed Pro hosting but it may not fit everyone's budget. Alternatively, you can self-host it on your own cloud servers. On Linux handbook, we already have a guide on deploying Ghost with Docker in a reverse proxy setup. Instead of Ngnix reverse proxy, you can also use another software called Traefik with Docker. It is a popular open-source cloud-native application proxy, API Gateway, Edge-router, and more. I use Traefik to secure my websites using an SSL certificate obtained from Let's Encrypt. Once deployed, Traefik can automatically manage your certificates and their renewals. In this tutorial, I'll share the necessary steps for deploying a Ghost blog with Docker and Traefik.