Tagged articles
7 articles
Page 1 of 1
Cognitive Technology Team
Cognitive Technology Team
Mar 23, 2025 · Fundamentals

Swapping Two Variables in Java Without a Temporary Variable

This tutorial explains how to exchange the values of two Java variables without using a temporary variable, covering three techniques—arithmetic addition/subtraction, multiplication/division, and bitwise XOR—along with complete code examples, step‑by‑step explanations, output results, and discussion of each method’s advantages, limitations, and appropriate use cases.

ArithmeticJavaProgramming tutorial
0 likes · 7 min read
Swapping Two Variables in Java Without a Temporary Variable
Ops Development & AI Practice
Ops Development & AI Practice
Jan 18, 2025 · Fundamentals

How to Find the Unique Number in O(n) Time Using XOR in Go

This article explains how to identify the single non‑repeating integer in a list where every other number appears twice, using an O(n) time and O(1) space XOR‑based algorithm, complete with Go code, step‑by‑step analysis, complexity discussion, and UML activity diagram.

Golangalgorithmspace complexity
0 likes · 6 min read
How to Find the Unique Number in O(n) Time Using XOR in Go
Liangxu Linux
Liangxu Linux
Aug 22, 2021 · Fundamentals

Swap Variables Without a Temp: The XOR Trick Explained

This article introduces the XOR (exclusive OR) operation, explains binary representation of numbers, demonstrates how XOR can swap two integer values without a temporary variable, and provides a concise C code example illustrating the technique.

bitwisevariable swapxor
0 likes · 4 min read
Swap Variables Without a Temp: The XOR Trick Explained
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Sep 11, 2019 · Fundamentals

Common Algorithm Tricks: Bit Manipulation, Two‑Pointer Techniques, and XOR Applications

This article reviews several practical algorithm tricks—including using n&(n‑1) to clear the lowest set bit, counting bits, converting numbers, applying double‑pointer methods to linked lists and sorted arrays, and leveraging XOR properties—to simplify typical interview coding problems.

algorithmbit manipulationtwo pointers
0 likes · 9 min read
Common Algorithm Tricks: Bit Manipulation, Two‑Pointer Techniques, and XOR Applications