Capture The Flag

Intro I was part of the CTF challenges admin team, where we worked on creating a CTF competition for our company. I didn’t have much experience with CTF before, so it was interesting to get involved in creating the challenges. There were four main topics I focused on when designing the problems. Btw, the problem titles are movies I recommend. Cryptography I like cryptography, and creating challenges for this CTF was really fun....

September 24, 2024 · 17 min · 3466 words · Me

Min heap implementation - C++

I have discussed the priority queue and implementations of queue, vector. Now, we are gonna discuss about min heap, also known as a priority queue. So, what’s this data structure? It has 4 main methods: size() - returns the number of the elements front() - return the current minimum element pop() - deletes the current minimum element push(element) - insert new element to the heap How do we implement this?...

October 13, 2023 · 4 min · 839 words · Me

Dynamic array implementation - C++

We discussed queue implementation in here and about vector here. Like a queue we will now discuss vector implementation in this post. A vector is a simple data structures similar to an array, but its size is dynamic. The main feature is that we can access any element in vector in O(1) time. Vector has three main methods size() - returns the number of elements. push(element) - inserts a new element at the back of the vector....

October 4, 2023 · 6 min · 1088 words · Me

Queue implementation - C++

We talked about queue in this post. Now, I’m gonna explain how to implement this data structure. What we need is a basic understanding of pointer and memory. Queue has 4 main methods size() - returns the number of the elements top() - returns the first element of the queue pop() - deletes the first element push(element) - insert new element back of the queue How hard can it be?...

September 24, 2023 · 4 min · 729 words · Me

Memory Management - PART 1

Memory and pointer We learned how to declare variables array, vector etc. But how do these things works under the hood? Lets start with memory. All the are stored in memory. For example if we declare array or vector, c++ will allocate new memory, which we can then use directly. If we no longer need these variable, they will be cleaned up automatically, like variables declared within a function. But, how do we know where they are stored?...

September 2, 2023 · 3 min · 476 words · Me

Union Find

About the Disjoint Set Union (Union Find) data structure: Judging by its name, the data structure consists of three words: union, find, and disjoint. There are three main operations or concepts associated with it. Determining to which part it belongs Union, which involves combining two separate parts. The structure has two actions. Initially, we start with multiple separate parts and the goal is to connect them easily while being able to determine to which part it belongs....

May 14, 2023 · 4 min · 698 words · Me

Graph

What is graph Wikipedia: A graph is a structure made of vertices and edges. I: Ok A graph can be described as a way of representing relationships between things. For example, let’s consider the relationship of friends. A is a friend of B, B is a friend of C, and C is a friend of D. Additionally, D is a friend of A, and B. In this scenario, we refer to these individuals as vertices, and the connections between them as edges....

May 13, 2023 · 9 min · 1815 words · Me

Binary search

Binary search algorithms are everywhere, and for good reason. They embody a simple yet powerful idea. In general, algorithms are named with purpose. Let’s take a closer look at this algorithm through an example problem. Problem We are given an ascending sequence of length N and Q requests. Each request consists of a number, and the answer indicates whether that number exists in the sequence. 1 <= N, Q <= 10^5, abs(a[i]) <= 10^9....

May 11, 2023 · 3 min · 525 words · Me

Power of number

Problem Find the answer obtained by raising A to the power of B, modulo the prime number 10^9+7. Here, A and B are both less than or equal to 10^13. We can find this using a simple loop. In other words, the number A is multiplied by B times, and we are talking about 10^13 times. How much action is that in general? A lot, and if you imagine that 300 million operations are performed in 1 second, then it will work for more than 9 hours....

April 15, 2023 · 5 min · 949 words · Me

Basic data structure

C++ has many simplified data structures that we don’t need to write ourselves, and let’s talk about them. At first, I will write about what they do, what their structure is, and then I think I will write the code for all of them myself and how they work. Array About Array. An Array can be thought of as a container that can hold many things. Currently we only store 1 value in 1 variable, so what if we need to store 2000 variables?...

April 4, 2023 · 9 min · 1769 words · Me