# Efficiently Merge Two Sorted Arrays Without Using Extra Space[O(1)][Gap Method][Detailed & Simplified]

In this post I am going to explain a method which is more efficient than the Insertion sort one. The time complexity of this method is O(NlogN) and space complexity is O(1).

This algorithm can be little tricky to understand for a beginner, that’s why I will not skip any step and will try to explain in very detailed and simplified manner. That’s why it is going to be a long explanation. So, just bear with me till the end.

Now, let’s see how this algorithm will work—

Step 1. We’ll start by calculating the next gap (You can think…

# Merge Two Sorted Arrays Without Using Extra Space [O(1)][Based on Insertion Sort][Simple Approach]

If we were allowed to use extra space then we can simply copy the elements of arr1[] (size n) and arr2[] (size m) into a new array arr3[] of size n+m and then sort the arr3[] and then recopy the elements into arr1[] and arr2[]. The time complexity of this approach would be O(n+m) (for copying) + O(nlogn) (for sorting) + O(n+m) (for recopying). The space complexity of this approach would be O(n+m) as we are creating an array of size m+n.

In this post I’ll go over Insertion sort type approach for merging two sorted array in O(1) space…

# How to edit built-in snippets in Sublime Text [Quick Guide][Super Easy Method]

If you want to edit built-in snippets of Sublime Text like for loop and vector etc. just follow these simple steps-

THE STEPS WITH SCREENSHOTS ARE GIVEN BELOW —

Step 1: I assume you’ve already used package control if not go to-

Tools — >Command Palette — >Package Control: Install Package.

Step 2: Search for the PackageResourceViewer in the Package Control and install it.

Step 3: After installation open Command Palette again (Tools →Command Palette) and search for PackageResourceViewer and you’ll see these three entries, after that click on Extract Package

Step 4: Select desired language from the list…

# HEIF(.HEIC) Image Support for Linux/Ubuntu [quick guide]

High Efficiency Image File Format (HEIF) is a container format for individual images and image sequences. It was developed by the Moving Picture Experts Group (MPEG).

The process is very simple, single command line execution.

This is achieved using a package called heif-gdk-pixbuf. It’s is available in ubuntu repositories and you don’t need to add any third party repository.

The command is:

`sudo apt install heif-gdk-pixbuf`

If the image isn’t opening in your default image viewer you can download Gpicview, It’s a lightweight image viewer with potential to become your default image viewer. This can be installed using —

`sudo apt install gpicview`

But most probably your default image viewer will work too —

tested on Ubuntu 20.04 LTS

Before —

After —

# Change Ubuntu’s Default Screenshot App to Flameshot [Change PrtSc Shortcut]

Didn’t like the default screenshot app?

Me neither. Why? you may ask.

Well, Ubuntu screenshot app is just for plain and simple screenshot, it doesn’t give you the option to edit it instantly!, although it gives you the option of selecting screen area when you take screenshot using shift + PrtSc.

There are plenty of apps out there which do give you the features of editing your screenshot just the way you like it. Here are the examples of such apps:

1. Shutter
2. Flameshot
3. Hotshots
4. Spectacle

I personally prefer Flameshot, because of its UI and features.

Here is the step-wise guide…

# How to Edit Top Bar Activities Tab in Ubuntu 20.04 LTS Focal Fossa

If you’re like me and want everything in your operating system to your taste, there is a chance you might want to edit top bar activities tab of your ubuntu. Here how you can go from this:

To this (or any icon or text or whatever you like, maybe you’re one of those people who like to put apple logo there, you can do that too):

## Hritik Chaudhary

Get the Medium app