Logo Miradil's Blog
  • Home
  • About
  • Skills
  • Experiences
  • Education
  • More
    Projects Publications Recent Posts
  • Posts
  • English
    English Azərbaycanca
  • Dark Theme
    Light Theme Dark Theme System Theme
Logo Inverted Logo
  • Posts
  • Introduction
  • DSA
    • CodeForces
      • 1918-A: Brick Wall
    • ICPC
      • 2023
        • Azerbaijani
          • Classify The Roman Numerals
        • Nordic
          • Karl Coder
    • LeetCode
      • 2: Add Two numbers
      • 58: Length of Last Word
      • 142: Linked List Cycle II
    • Eolymp
      • 87: Robot
      • 325: Dangerous route
      • 4036 & 4038: Pre-Order/Post-Order Traversal of a Tree
      • 6254: Timebomb
    • HackerRank
      • Queen's Attack II
      • Winning Lottery Ticket
      • Balanced Brackets
  • Django
    • How to detect field changes in Django
  • Reinventing the wheel
    • Linux command: `ls`
      • Command, file types and flags
      • Starting with C
      • Getting the list of files and their info
      • Processing flags
      • Sorting and formatting the output
  • Open Source Projects
    • Integrify
  • Misc
    • How did I get into programming?
    • How I got job in two hours
  • Podcast Notes
    • The Diary of A CEO
      • Vinh Giang
Hero Image
Eolymp 4036: Pre-Order Traversal of a Tree & 4038: Post-Order Traversal of a Tree

Problem statement These are two identical problems: Eolymp 4036 and 4038. The following problem statement is that of 4038, but explanation covers both problems. Given an array of integers. Create a Binary Search Tree from these numbers. If the inserted value equals to the current node, insert it to the right subtree. Write method PostOrder that makes Post-Order traversal of a tree. In this traversal method the left subtree is visited first, then the right subtree and finally the root node.

Friday, October 13, 2023 | 4 minutes Read
Hero Image
Eolymp 325: Dangerous route

Problem statement In one country there are n cities, some of which are connected by two-way routes. Cities are numbered by integers from 1 to n. In times of financial crisis the level of the crime in a state rose and the crime groups are organized. The most dangerous of these was “Timur and his gang” led by a notorious criminal circles by Timur, that commit robberies on most of the roads. As a result, some roads became dangerous to drive.

Wednesday, October 11, 2023 | 6 minutes Read
Hero Image
Karl Coder

This problem is from ICPC competition that I participated in on 7th of October, 2023. Problem statement Karl is an aspiring C programmer, and is excited by the risks and rewards of low-level manual memory management. In the program he currently develops, he stores a string containing N non-zero bytes into a buffer named “buf”. By mistake he accidentally made the buffer 2N bytes in size. The last bytes N of the buffer consists of only zero-bytes.

Monday, October 9, 2023 | 5 minutes Read
Hero Image
Leetcode 2: Add Two numbers

Problem statement You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Example 1 Input: l1 = [2,4,3], l2 = [5,6,4]

Saturday, October 7, 2023 | 3 minutes Read
Hero Image
Eolymp 87: Robot

Problem statement The infinite in both directions stripe with width 1 is divided into blocks of size 1 x 1. In one of these blocks the robot is located. It can move from one cell to another (the robot at the figure is marked with square). Its movements are determined by the program, each instruction is given by one of three capital letters: L, R, S. The instruction L says the robot to move one cell to the left, the instruction R - to move one square right, and S - to stay in the same cell. Program execution means the sequential execution of all instruction in it.

Friday, October 6, 2023 | 3 minutes Read
Hero Image
How did I get into programming and developed my skills?

This post has Azerbaijani version. Introduction I started my Computer Engineering bachelors in 2015 in ADA University. Back in my time, we started our first programming course with Java. I did not grasp some of the concepts, as I was not wise enough to practice and play around with codes that professor shared, even though he stressed that point a lot. Despite the fact that I understood all of the theory, when it came to implementation, I hesitated a lot, without knowing how to progress.

Thursday, October 5, 2023 | 4 minutes Read
Hero Image
Let's Rewrite Linux 'ls' command: Sorting and formatting the output. The Finale.

In this article we will apply flags from previous post and format output ls command. If you want to know more about command, please read Part 1. If you want to know how we configured tests, check Part 2. If you want to know how we collected info about files, check Part 3. If you want to know how we processed the flags, check Part 4 Note: Source codes can be found at: https://github.com/Miradils-Blog/linux-ls

Thursday, September 28, 2023 | 12 minutes Read
Hero Image
Let's Rewrite Linux 'ls' command: Processing flags

In this article we will start processing some flags of ls command. If you want to know more about command, please read Part 1. If you want to know how we configured tests, check Part 2. If you want to know how we collected info about files, check Part 3. Note: Source codes can be found at: https://github.com/Miradils-Blog/linux-ls Introduction In previous part we collected all necessary info of all files and printed them out. However, we used them only for printing, nothing else. For some flags, we don’t even need the info of certain files (by default, we do not need info of hidden files, or in case of -A we do not need data of current (.) and previous (..) directory, etc.). So, we need to process the flags to know which files we need to collect data of, and how to print the needed output. So, let’s start with flags, which affect our printing style.

Tuesday, May 23, 2023 | 11 minutes Read
Hero Image
Let's Rewrite Linux 'ls' command: Getting the list of files and their info

In this article we will start collecting info about files If you want to know more about command, please read Part 1. If you want to know how we configured tests, check Part 2. Note: Source codes can be found at: https://github.com/Miradils-Blog/linux-ls Getting the list of files First things first, our file structure looks like this (tree command was used for output): We have separate folder with different types of files for us to cover all cases. For now, we will hard-code the folder where listing will happen, just focusing on functionality. So, how do we get the list of all files and their respective data about ownership, size, links etc.? Lucky for us, C provides function for this (and honestly, for everything else as well):

Wednesday, May 10, 2023 | 9 minutes Read
Hero Image
Let's Rewrite Linux 'ls' command: Starting with C

In this article we will start the first steps to rewrite ls command. If you want to know more about command, please read Part 1. Note: Source codes can be found at: https://github.com/Miradils-Blog/linux-ls The easy way Actually, C provides a function to run any OS command, and print its output: system. From the example in the reference, we see that, we can just take arguments from shell and pass it to that function, and it is done. The following code is just a showcase, and is far from optimized:

Friday, May 5, 2023 | 4 minutes Read
Hero Image
Let's Rewrite Linux 'ls' command: Command, file types and flags

Note: For the whole series, Zsh is used, for which, output can be different compared other shell profiles. Introduction The ls command is one of the most commonly used commands in Linux/UNIX. This command is used to list the contents of a directory. Without any flags, we have the following output: What are these colorful file names? Well, let’s find out! File Types There are 8 main types of files in Linux:

Friday, April 28, 2023 | 3 minutes Read
Hero Image
Introduction

Greetings! I am Miradil Zeynalli, an engineer/developer/tech enthusiast slash, slash slash… I am here to share my findings and experiences from tech world with all of you interested. I will also share my international experience in Lund University. Make sure to follow me!

Monday, April 24, 2023 | 1 minute Read
  • ««
  • «
  • 1
  • 2
  • »
  • »»
Navigation
  • About
  • Skills
  • Experiences
  • Education
  • Projects
  • Publications
  • Recent Posts
Contact me:
  • miradil.zeynalli@gmail.com
  • mmzeynalli
  • Miradil Zeynalli
  • @mmzeynalli
  • Miradil Zeynalli
  • @mmzeynalli

Toha Theme Logo Toha
© 2024 Copyright.
Powered by Hugo Logo