by Suf | Oct 12, 2024 | DSA, Rust, Sorting Algorithms
Heap Sort is an efficient, comparison-based sorting algorithm that uses a binary heap data structure to organize and sort elements. It is mainly known for its ability to sort data in O(n log n) time and in-place sorting nature, meaning it doesn’t require additional...
by Suf | May 27, 2022 | Programming, Rust, Tips
We can calculate the absolute value of a number using the abs() method. We have to specify the numeric type before we call the abs method, for example, if we want a 32-bit signed integer we need to put i32 after the number. This tutorial will go through how to...
by Suf | May 20, 2022 | Programming, Rust, Tips
In Rust iter() returns an iterator of slices, into_iter() returns an iterator from a value, and iter_mut() returns an iterator that allows modifying each value. This tutorial will detail the Iterator and IntoIterator traits and the differences between the three...
by Suf | Mar 20, 2022 | Programming, Rust, Tips
This tutorial will go through how to read and write to a file for Rust version 1.26+ and Rust version 1.0. Table of contentsRead a File to String in Rust 1.26+Read a File to String in Rust 1.0Read a File to Vec<u8> in Rust 1.26+Read a File to Vec<u8> in Rust...
by Suf | Mar 20, 2022 | Programming, Rust, Tips
This tutorial will go through how to convert a string to an integer/float and vice versa. Table of contentsNumbers in RustIntegersFloatsRust Convert String to IntegerRust Convert Integer to StringRust Convert String to FloatRust Convert Float to StringRust Convert...
by Suf | Mar 19, 2022 | Programming, Rust, Tips
This tutorial will go through how to split a string in Rust. Table of contentsSplit String in Rust Using split()Split String in Rust Using split_whitespace()Split String in Rust Using lines()Split String in Rust Using RegexSplit String on Multiple Delimiters in...