teleren/devto huggingface dataset:
Insertion Sort Algorithm with Example in c++
Published: 2022-04-03 07:44:02

Insertion Sort Algorithm with Example in c++
Today we will learn about the insertion sort algorithm. The working procedure of insertion sort is also simple like bubble sort and selection sort we’ve learned before. Like selection sort, we have to also divide the array into two partitions, from 0 to i-1 is sorted and from i to n-1 is unsorted. Where i is the index that divides the array.

The insertion sort tutorial
What we have to do is pick the first element temp from the unsorted segment (from i) and place it in position ‘j’ where the element of position j-1 is less than temp. Before that, all the elements from position j to i-1 will be shifted from one position to the right. 

Algorithm for insertion sort
[Insertion Sort Algorithm with Example in c++
](https://www.cstutorial.org/algorithom/insertion-sort-algorithm-implement-with-c)
Bubble Sort Algorithm with Example and Time Complexity
Published: 2022-04-03 07:43:08

Bubble Sort Algorithm with Example and Time Complexity
Bubble sort is an algorithm that can sort an array of n elements. It is one of the most fundamental sorting algorithms in computer science. Understanding bubble sort is important to understand other sorting algorithms which are faster than it. Also, bubble sort is easy to implement than other sorting algorithms like Merge sort, Quicksort, etc. Bubble sort compares all elements of the array based on their value and swaps it under a certain condition.

What is sorting anyway? Sorting is the way to rearrange elements in the array under a certain condition. 

How does bubble sort works?
When we wanted to sort an array of size n in ascending order, bubble sort started by comparing its first two values. Let’s say, we have an array arr[n] of size n and an index i. Then if arr[i]>arr[i+1], we will swap their position because in ascending order greater element can’t come before the lesser element (i<i+1). The move ‘i’ by one. We will repeat this process repeat it n-1 times. 

If we repeat the process above n times [including n-1 time repeatation], then in each process greater element will be bubble up to the end. It is something like when a water bubble comes to the top from the bottom. That is why we call this algorithm Bubble sort.

Let’s see the algorithm for bubble sort
[Bubble Sort Algorithm with Example and Time Complexity
](https://www.cstutorial.org/algorithom/bubble-sort-algorithm-with-example-and-time-complexity)
Project One (Python): Text Adventure Game
Tags: python, beginners, programming, github
Published: 2022-04-03 07:41:51

## Why?
Hello, this is my first posted project. This project was created with the intention of exposing myself to python, stack overflow, GitHub workflow, and developer tools.


![Screenshot of title screen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oz1tre1rd9ow0ns7p20s.png)

## How
The project uses beginner coding concepts in order to create a simple text adventure game in the python terminal. The imported modules are time and random, with all other functions being built-in.

[GitHub](https://github.com/shiahalan/text-adventure-game)

## Conclusion
I hope you enjoy this part of my learning process!

## Advice?
Advice is greatly appreciated (post in comment section).
My digital classroom experience
Published: 2022-04-03 07:22:31

Inspired by [this post](https://joelchrono12.ml/blog/handwritten-homework/) from joelchrono12 I wanted to talk about my experience with the digital lessons that my school provides and just the state of digitization in general.

## What things does my school use
For video conferencing and literally **everything** else, my schools uses Microsoft Teams.
They went all in on the Office 365 Suite pretty early on.

In the first lockdown that we had here, the teachers would give us tasks via Teams Tasks that we could turn in directly on the platform.

My school also deployed digital whiteboards from [ProWise](https://www.prowise.com/en/prowise-touchscreen-ten/).

Now, after the lockdowns we got laptops for school use. (Really *only* school use. You can't even change the wallpaper.) We use them to take notes in OneNote for example.

## The problems I encountered
Office 365 - or as it is now called Microsoft 365 - isn't my dream setup for school. I'd much rather use a self hosted Nextcloud instance with Nextcloud Talk or Element for communication. That's not what I got, instead I got problems.

In the first lockdown, this new system was really stress-tested. The teachers had to learn to use it and simultaneously they had to teach their students. Not everything was smooth sailing.

On top of that Microsoft pulled a real Microsoft again. Microsoft Teams Video Conferencing just didn't work the first weeks, Office 365 had multiple outages to the point where you couldn't even login and this:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/u0lmy2r1fwltdk7h4ite.png)
 

Word saying: "Word can't open the document because the service is too busy at the moment. Please refresh the page again."
No one could access their documents.

On top of the technical fails, came the teachers that gave us *way to much* homework. Sometimes I sat on one task for 4 hours straight, knowing if I manage to finish it, I still got 3 other tasks I need to do.

## The good things that I got
It wasn't all broken and depressing, though.

In that time, I massively improved my grades. I started to experience, that school can be fun.
Sometimes I had a task completed so fast that I just made up a new one just to learn more about a topic.

Now, we're back in Face-to-face teaching and I still experience the techincial problems of the microsoft cloud 🌧 from time to time, but I also know that school can be fun.

P.S.: I was today years old as I learned you *cannot* export OneNote Documents in any form.
I care about privacy
Tags: privacy
Published: 2022-04-03 07:20:34

This website doesn't track you. It doesn't sell your data or displays ads.
I purposefully didn't include any ads or trackers because I care about privacy.

I think privacy is a good thing and everybody should care about it. But I also do regret my decision of climbing down the rabbit hole of internet privacy sometimes.

The state that privacy has in our society is troubling. "I have read and accept the privacy policy." is the biggest lie of the internet.

## How to achieve privacy
What is privacy and how do I get it?

Privacy isn't a thing you can have or don't have it. It's not binary, it's a scale where *you* decide *how much* privacy you want or need.

You can just install Signal to make you communication secure, but is it enough? **That depends on you.**

### Incremental Change
This one is really important I think.

I see this so often and it's just sad: Youtube videos for "privacy minded" people that tell you things like "don't use Signal, it's owned by the FBI and they can read all your messages. Switch to `<random messaging app that no one uses>` instead."

Signal has it's criticisms - as does every single app or service that was ever created - that's not the point.
It's sad that such videos get recommended to people who just start out.

Those videos decourage people to even start their privacy journey, they may have valid points but the videos directly go all-in and overwhelm people.

Now comes the important part - write it down, print it out, just memorize it: 

> Incremental change (e.g. first installing Signal) is **not** bad. Encourage incremental change.

It's way easier getting all your contacts to install Signal then to use Matrix for example. Matrix isn't bad, but the process of joining it isn't as simple as with Signal.

Believe me, I've tried.

## Until then

Until we have a society where everyone cares about privacy, just do a few simple things:
1. Spread the word. You can influence the people around you, to join your journey of privacy.
2. Go easy on them: Don't discourage their first steps.
3. Let them have a life, it isn't all privacy. There are way more exciting and beautiful things out there.

I hope that someday the value of privacy increases in our society.

That said: Thank you for reading and I hope this post was somewhat informative or enjoyable.
Have a nice rest of your day! 🌞
Anytype: operating system for life?
Published: 2022-04-03 07:18:19

After Evernote restricted the number of devices you could use with the free plan, I moved over to Notion.
Notion isn't just a simple note taking app with independent documents, its a big database, where every note can connect to other notes making it easy to sort things into categories.

![Notion UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1gs19arcsxtqv85veyu.png)
 
I've used Notion for a long time, but after I really got into privacy, I started to search for a encrypted alternative.
I wasn't comfortable anymore with organising my entire life in one central, unencrypted place owned by some coorporation.

So, I started to search for an alternative.
I eventually found Anytype, but it was invite only, so I couldn't try it yet.

I moved on and started using Standard Notes. I still use it today, and I am pretty happy with it.

Now I got access to the [Anytype alpha](https://anytype.io) and wanted to write about it here.

When you launch Anytype for the first time, you are greeted with a [seed phrase](https://www.coinbase.com/de/learn/crypto-basics/what-is-a-seed-phrase) that secures your private key.

After you save that key and proceed, you get to your homescreen.

![Anytype Homescreen](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p8lmi1saxeych360isuk.png)

On the homescreen, you can create new sets using pre-build templates using the plus button on the top right.

![Create a new Set](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qtk309zvg4tv46f6dudr.png)

Your anytype "account" is encrypted using a private key that is protected by your seedphrase and it is synced using IPFS.

Because of that, you can also use Anytype on your Smartphone:

![Anytype on Android](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v5svpxlv5al8j3bwn6wp.png)
 

![](mobile.png)

One thing I noticed with the desktop app is that is always launches in full-screen mode and it feels kinda sluggish.
I probably won't continue to use it for now, but we'll see how Anytype evolves.
Openadhan: Muslim prayer times PWA made with ReactJS
Tags: react, reactrouter, mui, adhan
Published: 2022-04-03 07:03:50


![Openadhan logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/grw0yiplcjjzlad58y04.png)

## About
[Openadhan](https://openadhan.wrb.app) is a Web application made with Reactjs for calculating Muslim prayer times using local (auto) geo position (geotagging) or manually calculated geo position (reverse geotagging) (with city search).
Link: ( [https://openadhan.web.app](https://openadhan.web.app) )

## How to get the source code of Openadhan?
Well, you can get Openadhan source code from Github ([link](https://github.com/adelpro/Openadhan))
Support us by giving a star ⭐
## Features:
✔ _Simple to use_:
With responsive navigation menu mobile ready (sandwich) with active class to show the active (current) page, animated cards with minimalist white design and transparent footer, using Material UI v5
✔ _Auto geo position (geotagging)_:
calculating the location using the coordinates (latitude and longitude) calculated with the device sensors then showing the related city name using two different geotagging API ([Nominatim API](https://nominatim.org/): free open source, [Bigdatacloud API](https://www.bigdatacloud.com/): free limited)
✔ _Manual geo position(reverse geotagging)_:
searching for geoposition manually using city's name with the help of reverse geotagging API( [Nominatim API](https://nominatim.org/): free open source)
✔ _Made with ReactJS_:
ReactJS v.17 and React-router v.6
✔ _PWA ready_:
with service worker, manifest file, installable
✔ _Multi language (Arabic, English)_:
You can change the application UI language with a simple drop-down select menu, using React hooks and React Context API.
✔ _Configuration page_:
To adapt the app to your needs (UI , Adhan configuration, location, show/hide cards).
✔ _Save/load configuration from localStorage API_:
the configuration and geoposition is saved to the local storage using :[localStorage API](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage).
✔ _Offline API fetch_:
The results from Geoposition API fetch is saved in localstorage and loaded if there is no internet connection.

## Screenshots:
Desktop UI

![Desktop UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l78jse5uihu2xcyyykso.jpeg)

![Desktop UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g48ugppujuhvf01nhyau.png)
Mobile UI

![Mobile UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/edw5y1vz13v837ug01if.jpeg)

## Used libraries:
✔ ReactJS
✔ React-router v6
✔ MaterialUi v5.
✔ AdhanJS

## Contact us:
Twitter: @adelpro

## Support us ❤️:
[Buymeacoffee](https://www.buymeacoffee.com/Adel.benyahia)
Introduction to graph theory
Published: 2022-04-03 06:51:34

Introduction to graph theory
In computer science, graph theory is the study of graphs. Graphs are the mathematical structures by which we can study relations between objects. A graph is made up of vertices that are connected with edges. Trees are also a special kind of graph. In this tutorial, we will learn about graph data structures and their terminologies.

The definition of a graph
A graph is a set of (V, E) where V is the set of the vertices and E is the set of the edges. In the graph below,

V={A,B,C,D,E} and E={AD, CD, BC, CE}.

Let's see a graph. Look at the picture below.

Introduction to graph theory
In computer science, graph theory is the study of graphs. Graphs are the mathematical structures by which we can study relations between objects. A graph is made up of vertices that are connected with edges. Trees are also a special kind of graph. In this tutorial, we will learn about graph data structures and their terminologies.

The definition of a graph
A graph is a set of (V, E) where V is the set of the vertices and E is the set of the edges. In the graph below,

V={A,B,C,D,E} and E={AD, CD, BC, CE}.

Let's see a graph. Look at the picture below.

[Introduction to graph theory](https://www.cstutorial.org/data-structure/graph-data-structures-introduction-to-graph-theory)
Introduction to the tree data structure
Published: 2022-04-03 06:50:48

Introduction to the tree data structure
In this article, we will learn about tree data structure. In this writing about graphs, I have talked about various kinds of graphs. In this writing, I’m going to introduce you to the trees and tree terminologies.

Trees are the special kind of undirected graph where there is no cycle in it. More formally trees are the undirected connected acyclic graph in which two vertices/ nodes are connected using exactly one edge.

Introduction to the tree data structure
In this article, we will learn about tree data structure. In this writing about graphs, I have talked about various kinds of graphs. In this writing, I’m going to introduce you to the trees and tree terminologies.

Trees are the special kind of undirected graph where there is no cycle in it. More formally trees are the undirected connected acyclic graph in which two vertices/ nodes are connected using exactly one edge.

[Introduction to the tree data structure](https://www.cstutorial.org/data-structure/introduction-to-the-tree-data-structure)
Singly Linked List in Data Structure
Published: 2022-04-03 06:50:11

Singly Linked List in Data Structure
Today we will learn about the singly linked list. We will learn about others in my next writings. 

Like arrays, Linked List is a linear data structure. linked list elements are not stored at an adjacent location; the elements are linked or connected using pointers. The basic concept of link list read it.

Linked list insert operation
 
Here we will describe the linked list insert operation and also implement its algorithm. 


Insert at the end of the linked list,
First of all, we will see how to insert a new node at the end of the list.
The insert at the end operation has two parts. 

Finding the end of the node.
Create a new node and set it as the value of the next pointer of the end node.
We need an extra pointer to store the first node of a linked list, we call it a head node. If the linked list is empty, its value will be NULL, else it will point to the address of the first node.
Let’s take a look at the insert function below,

[Singly Linked List in Data Structure](https://www.cstutorial.org/data-structure/singly-linked-list-in-data-structure)
Linked List in C++ with Example
Published: 2022-04-03 06:49:19

Linked List in C++ with Example
In computer science, a linked list is a linear data structure whose order is not given by its position in the memory. instead, each element (aka nodes) is connected by a special variable we call it next pointer. What does it mean?

Difference between linked lists and arrays
We assume everyone is aware of arrays. An array is a linear data structure. Here data is sequentially stored in the memory. On the other hand, a linked list doesn’t store data sequentially. It will be helpful if we visualize the storage mechanism for both an array and a linked list.
[Linked List in C++ with Example](https://www.cstutorial.org/data-structure/linked-list-in-c-with-example)
Queue Data Structure
Tags: datastructure
Published: 2022-04-03 06:48:26

Queue Data Structure
A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO)

Imagine you are at the front of a bank’s cash counter. There are five people before you. The first five-person will be able to complete their work early because they’ve come before you. This is a proper example of a queue. 

Queue Data Structure
A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO)

Imagine you are at the front of a bank’s cash counter. There are five people before you. The first five-person will be able to complete their work early because they’ve come before you. This is a proper example of a queue. 

[Queue Data Structure](https://www.cstutorial.org/data-structure/queue-data-structure)
Stack Data Structure in C++
Tags: datastructure
Published: 2022-04-03 06:46:38

Stack Data Structure in C++
Hey there, in this writing I’m going to discuss the array implementation of stack and queue. Note that it is not ideal because using an array in the place of a linked list has some drawbacks we’ll discuss later. 
First of all, we have to remember that, we can’t change array size once we’ve declared it. That means the stack and queue’s max size limit will depend on the array size.
Previously we’ve learned about the linked list implementations of the stack and queue. You can check it out if you are not already learned about it.

What is a stack? 
Stack is a linear data structure that follows a particular order in which the operations are performed. The order may be LIFO(Last In First Out)

Imagine a case where you have a pile of books and the books are placed one upon another. Now you have to pick the bottommost book from the pile. To do so, you have to pick the topmost book first, then the second book, and so on until the last book. Here, we can say the book at the top was placed at the end. In the scenario, the pile is called a stack.

[Stack Data Structure in C++](https://www.cstutorial.org/data-structure/stack-data-structure-in-c)
3 Dev.to tips I hoped someone told me
Tags: beginners, career, writing
Published: 2022-04-03 05:42:16

Hello World! :wave:

I've been using dev.to for quite a while now, and I have a few juicy tips I would like to share! :smile: I really hope they help you become a better developer and writer!

## Tip Number 1 (Be Honest)

If you are a bad developer, well, don't pretend to be a pro. You don't have to write an article named "I am a bad dev." because well, that's silly.

You know why being honest is important? Because you're yourself when you are honest! :grin: And guess what, you are the best at being yourself.

## Tip Number 2 (Use Emoji & Hooks)

Emoji's are a great way to keep our audiences hooked, but make sure not to overuse them, the same for hooks. After all, we are writing to help each other. :wink:

Try not to spam your audiences with emoji's or hooks, just one or two hooks in the introduction is enough. An emoji or two per paragraph are also recommended. :thumbsup:

Keep your writing neat and unique, or even special, but try not to be weird. :stuck_out_tongue: Try to hook your audience, but don't annoy them, that's the last thing anyone wants! 

## Tip Number 3 (Be Inclusive)

We are humans, and humans want to be part of a group. Humans want to be included, not excluded. The last thing we want is to be excluded. You want your audience to feel like they "belong". :wink:

Well, this strategy is especially easy with dev.to, because pretty much anyone using this is a developer, or at least is interested in programming or technology. :laughing:

## Bye World
In other words, conclusion. Hope all of you have a good day! Now close this tab and get coding!
Introducing Mantis (M-Ant-is) React Dashboard Template
Tags: react, mit, mui, javascript
Published: 2022-04-03 05:24:39

Having a good aesthetic in any website always plays crucial role for user experience. Color combination, choice of fonts, spacing, padding are all those small things however it make important aspect for any site. It make better user experience of site which let user to stay on site without getting bored in few minutes.

### What is Mantis?
Mantis is a react admin template having aesthetic derived from ant design and component used from MUI. Ant design have excellent design style with enterprise solutions in mind where as MUI having good set of components. **Mantis (M-Ant-is) is combination of both, design inspiration from Ant and component from MUI**.

### Why Ant aesthetics?
Ant has gain popularity since last few years and adoption of design has been increased in enterprise applications. It provide beautiful UI with simplicity which fit perfect for any web application. With that, It provides polished and enterprise look and feel.

### Why MUI(Material-UI)?
MUI has grown popularity of components. With well managed components system, one can derived entirely new design system as well. Configuration of component and styling make it easy to adopt. Its suite for any naïve developer as well to begin from scratch.

Having both on single, make Mantis best admin template.

### What is inside Mantis?
Mantis will have set of beautifully blended components with ready made applications as well. It will have Figma to play with your design requirement.

It will be available in two version. MIT and Paid. MIT version is ready to use via GitHub while Paid version will be listed in MUI Store exclusively.

#### Technology Stack

We are committed to use the latest technology stack to achieve the best end product. In that way we have consider & implementing the following technologies in Mantis react admin template.

- Material UI for component library
- NPM/Yarn for package installation
- React Hook
- Redux Toolkit
- React Redux for UI Bindings
- CSS-in-JS
- JavaScript & TypeScript
- CRA & Next JS 
- Prettier for code formatting

#### Key Features 
Mantis allows you to build feature-rich and professional interfaces while focusing on the core functionality. It is built with modern technologies, ensures a great developer and designer experience. The simplicity of using it is that a designer or developer of any level can build, design and ship any outstanding web applications using Berry. Following are the key features that make a top-class React Admin Template.

- 100+ Ready to use pages
- Figma design files
- Easy to use folder structure
- Material UI v5 Component Library
- Authentication methods - Auth0, Firebase, JWT, AWS
- Dark/Light Mode
- Live customizer - Font family selection, Layout style modifier
- Multi-Language Support
- LTR/RTL (Right to Left) Mode

### Try Mantis

[Preview](https://mantisdashboard.io/free/)
Download [Free](https://github.com/codedthemes/mantis-free-react-admin-template).