DEV Community

Andrew
Andrew

Posted on

2 Week Of : “Spark” Project

Friday. Time – 12:53 AM (in China).

Yes, in practice I didn’t manage to complete my plan within the week, but I had a lot of business stuff going on — one night I didn’t even sleep at all, nearly 24 hours straight. And on the other days I slept 5, 6, 7, or at least once even 8 hours. In reality though, I still have tonight — and no one canceled that. Time is a myth, just like thoughts, the future, the past, or even the present. If you look deeper into time, you’ll realize we don’t have it — and at the same time, we do. I believe there’s no point wasting something we kind of don’t even have, on things that are completely meaningless. Although, everyone does as they please, but I’ve chosen my own path. Below is the text I wrote, I think, on Thursday.


This is how I learn Chinese. (The mnemonic method is weird, but it’s from the book Unlimited Memory. I’ve already memorized over 400 words in 3 months and one week. I also write down abbreviations for these words with later pronunciation of them, in addition to the more obvious reasons to remember these words for real-life situations → a method I got from YouTube. For once that platform was actually useful, and not just triggering FOMO.) I’ve been living in China for 3 months now, so I occasionally have conversations with native speakers, plus minimal practice with them. 400 words is very little… even a child knows way more. 1,000 words is the first minimum to understand most basic topics, and I still have a lot to learn. Also, sentence construction is often not obvious, which means I’ll need to memorize lots of phrases, particles, forms, structures, etc. Oh, almost forgot. I’m from Russia, so it’s much easier for me to come up with homonyms and associations in Russian… I’m baring my soul with this post, because many of the things below came to me by chance and initially in the form of a weird “mini-story.” I should also mention that even tones are included in my mnemonics, because if you pronounce even a single vowel at the wrong pitch, you probably won’t be understood…


The words themselves (absurd, but it works):


  1. bǎi - hundred, numerous (Можно сказать бай огромному количеству знакомых, наверное сотне) *Например, это стоило 100 юаней
  2. bào zhǐ (бАо джи) - newspaper, newsprint (Да он избалованный джином словно, вот так пишет эти газеты)
  3. guò - to pass (time), to celebrate (Гула то сколько было, но время прошло, вы же отмечали?)

Next, I have 2 tests awaiting me from both sides (Chinese – English), which I might pass immediately, but usually I need to revise certain unlearned words first and only then pass everything. That’s how I test myself.

And I still have 3 projects, and possibly tennis coaching (the last one is not certain yet). One of them is a joint project, the other 2 are my personal ones. I don’t know how I manage everything, but I’m extremely motivated, because nothing else in this life or the entire world interests me.

And here are my 5 behind-the-scenes topics on computer theory (all links are in Russian, for an obvious reason… Previously, I tried learning completely new topics without knowing the basics and in a foreign language, especially English — it was pointless and difficult):

Basics of Electronics

http://beam-robot.ru/electronics_for_beginners/electronics_base.php
Capacitor (this is the term I wanted to understand better)

Boolean Algebra (Logic Algebra)

http://beam-robot.ru/electronics_for_beginners/logical_algebra.php

Logical Addition (Disjunction)

http://beam-robot.ru/electronics_for_beginners/disjunction.php

Logical Multiplication (Conjunction)

http://beam-robot.ru/electronics_for_beginners/conjunction.php

Logical Negation (Inversion)

http://beam-robot.ru/electronics_for_beginners/inversion.php


1. Basics of Electronics

Questions:

  1. What is electric current?
  2. What’s the difference between alternating current (AC) and direct current (DC)?
  3. What are a resistor, capacitor, and inductor?
  4. How do a diode and a transistor work?
  5. What is Ohm’s law? Write down the formula.
  6. What are logic levels in digital electronics (0 and 1)?

Answers:

  1. Electric current is the directional flow of charged particles (electrons or ions).
  2. AC changes direction (e.g., in a wall outlet), DC flows in one direction (e.g., a battery).
  3. * Resistor – resistance, limits current.
    • Capacitor – stores charge.
    • Inductor – creates a magnetic field when current flows through it.
  4. * Diode – allows current to pass in only one direction.
    • Transistor – amplifies or switches current (e.g., NPN/PNP types).
  5. Ohm’s Law: $V = I \times R$ (Voltage = Current × Resistance).
  6. Logic 0 – low voltage (~0V), logic 1 – high voltage (~3.3V or 5V).

2. Boolean Algebra (Logic Algebra)

Questions:

  1. What is Boolean algebra and where is it used?
  2. What are the basic logical operations?
  3. What is a truth table?
  4. How are logical expressions written?

Answers:

  1. Boolean algebra is a branch of mathematics that studies logical operations on statements (true/false). It is used in digital electronics, programming.
  2. Basic operations: AND, OR, NOT, XOR (exclusive OR).
  3. Truth table – a table showing the result of an operation for all possible input combinations.
  4. Logical expressions are written using variables (A, B) and operators (∧, ∨, ¬).

3. Logical Addition (OR)

Questions:

  1. How does the OR operation work?
  2. What is the truth table for OR?
  3. What does the logical expression for OR look like?
  4. How is OR implemented using transistors or relays?

Answers:

  1. OR outputs 1 if at least one input is 1.

  2. OR truth table:

| A | B | A∨B |
| - | - | --- |
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |

  1. Expression: $A + B$ or $A \lor B$.

  2. In electronics, OR can be implemented with diodes or transistors (parallel connection).


4. Logical Multiplication (AND)

Questions:

  1. How does the AND operation work?
  2. What is the truth table for AND?
  3. What does the logical expression for AND look like?
  4. How is AND implemented with transistors?

Answers:

  1. AND outputs 1 only if both inputs are 1.

  2. AND truth table:

| A | B | A∧B |
| - | - | --- |
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |

  1. Expression: $A \cdot B$ or $A \land B$.

  2. In electronics, AND is implemented using transistors connected in series.


5. Logical Negation (NOT)

Questions:

  1. How does the NOT operation work?
  2. What is the truth table for NOT?
  3. What does the logical expression for NOT look like?
  4. How is NOT implemented with transistors?

Answers:

  1. NOT inverts the signal (01, 10).

  2. NOT truth table:

| A | ¬A |
| - | -- |
| 0 | 1 |
| 1 | 0 |

  1. Expression: $\overline{A}$ or $\neg A$.

  2. In electronics, NOT is implemented with a transistor (inverter).


And 1 C++ topic.

📘 Original tutorial source (in Russian)


1. Basics of Loops in C++

Questions:

  1. What is a loop in programming?
  2. What types of loops exist in C++?
  3. What’s the difference between while, do-while, and for?
  4. How do you avoid an infinite loop?

Answers:

  1. A loop is a construct that repeats a block of code as long as a condition is true.
  2. C++ offers:
  • while – loop with a pre-condition
  • do-while – loop with a post-condition
  • for – counter-controlled loop

    1. Differences:
  • while checks the condition before execution

  • do-while executes the body at least once, then checks the condition

  • for is a compact loop with init, condition, and update

    1. To avoid infinite loops:
  • Ensure the exit condition is reachable

  • In for, verify the counter is changing correctly

  • In while/do-while, avoid conditions that are always true


2. The while Loop

Questions:

  1. How does while work?
  2. What is the syntax of while?
  3. When is while better than for?
  4. Can while run zero times?

Answers:

  1. while executes code as long as the condition is true
  2. Syntax:
while (condition) {
    // loop body
}
Enter fullscreen mode Exit fullscreen mode
  1. Use while when the number of iterations is unknown (e.g., reading a file)
  2. Yes — if the condition is initially false, it won’t run at all

3. The do-while Loop

Questions:

  1. How does do-while work?
  2. How is it different from while?
  3. When should you use do-while?
  4. Is ; required after while()?

Answers:

  1. do-while executes the body first, then checks the condition
  2. Difference:
  • do-while guarantees at least one execution
    1. Use it when you need one execution minimum (e.g., menu input)
    2. Yes, semicolon is required after while():
do {
    // body
} while (condition);  // ← don't forget ;
Enter fullscreen mode Exit fullscreen mode

4. The for Loop

Questions:

  1. How does for work?
  2. What are the parts of a for loop declaration?
  3. Can parts of for be skipped? (e.g., initialization)
  4. How do you count backward (10 to 1)?

Answers:

  1. for executes code while the condition is true, updating a counter
  2. Structure:
for (init; condition; update) {
    // body
}
Enter fullscreen mode Exit fullscreen mode
  1. Yes, parts can be skipped, but semicolons are required:
int i = 0;
for (; i < 5; i++) {
    ...
}
Enter fullscreen mode Exit fullscreen mode
  1. Reverse countdown:
for (int i = 10; i >= 1; i--) {
    cout << i << " ";
}
Enter fullscreen mode Exit fullscreen mode

5. Loop Control (break, continue)

Questions:

  1. What does break do?
  2. What does continue do?
  3. Can break and continue be used in all loops?
  4. How do you exit a nested loop?

Answers:

  1. break immediately exits the loop
  2. continue skips the current iteration, moving to the next
  3. Yes, both work in while, do-while, and for
  4. To exit nested loops:
  • Use break in the inner loop
  • Or use goto (not recommended) or flags:
bool exitFlag = false;

for (int i = 0; i < 10 && !exitFlag; i++) {
    for (int j = 0; j < 10; j++) {
        if (condition) {
            exitFlag = true;
            break;
        }
    }
}
Enter fullscreen mode Exit fullscreen mode

6. Practical Tasks (To check your understanding)

1. for loop: Print even numbers from 2 to 20

for (int i = 2; i <= 20; i += 2) {
    cout << i << " ";
}
Enter fullscreen mode Exit fullscreen mode

2. while loop: Sum numbers until user enters 0

int num, sum = 0;
while (true) {
    cin >> num;
    if (num == 0) break;
    sum += num;
}
Enter fullscreen mode Exit fullscreen mode

3. do-while: Ask for password until "12345" is entered

string password;
do {
    cout << "Enter password: ";
    cin >> password;
} while (password != "12345");
Enter fullscreen mode Exit fullscreen mode

🔍 Optional Topics to Explore Further

  • Nested loops
  • Loop optimization (++i vs i++)
  • Range-based for loop (C++11 and newer)

🌙 Now, Back to Monday Night...
I still have 4 algorithms left to write and need to pass a test on Chinese vocabulary.
Also, I’ll review all CS and C++ topics one more time.

Top comments (0)