Published on

Data Structures with Kotlin: Knowledge

Authors

After you have an understanding of the Kotlin programming language, it's time to delve deeper into data structures & Algorithms to enhance your skills for conquering the world.

Let's go!!!

What is a Data Structure?

Refer to the Wiki Pedia definition of Data Structures.

Every program execution needs memory to store variables.

The way variables are organized in a program to facilitate allocation, access, update, or deallocation of memory is called a Data Structure.

Some commonly used Data Structure types in programs: Linked Lists - List; Arrays - Array, Hash Tables - HashTable - HashSet, Stack, Queue ,..

What is an Algorithm?

An algorithm is a set of specific processing steps to solve a particular problem.

In a computer program, an Algorithm is how a Programmer organizes the Logic to handle the problem.

For example: An algorithm to determine if a natural number N is Prime or not. An algorithm to convert Roman numerals to natural numbers and vice versa. An algorithm to encrypt a piece of text. An algorithm to decrypt a piece of text. …

Concepts of Time Complexity and Space Complexity

To measure the complexity and resource consumption of an algorithm, two concepts are used: Time Complexity and Space Complexity.

Time Complexity is an indicator of the increase in execution time of an algorithm as we increase the size of the input data. It gives us an overview of an algorithm, understanding the correlation between performance and the size of the input.

Space Complexity is an indicator to measure the increase in memory consumption (RAM) when changing the size of the input data.

Both indicators are very important in algorithm design, and need to be understood and grasped well to be able to adapt well during the interview and work process.

Time Complexity of some commonly used Data Structure types