Unique String

This is an essential algorithm to finding unique characters within a string.

  • Bools are used when you want to check if you want to check if an element has been hit once.
  • Benefits: Boolean variables are always smaller as they only require 1 byte
  • Negatives: You are restricted to a binary value
bool charArray[128]; // # of possible Unicode values
  • A more flexible option would be using integers.
  • Benefits: Useful for counting
  • Negatives: Ints require 8 bytes. They requires 8x the space as bools.

results matching ""

    No results matching ""