Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 706905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:13:05+00:00 2026-05-14T04:13:05+00:00

Implement an algorithm to determine if a string has all unique characters. What if

  • 0

Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:13:05+00:00Added an answer on May 14, 2026 at 4:13 am

    If you can use a little auxiliary memory, then a small array of bits (indexed by the numerical code of the character) is all you need (if your characters are 4-byte Unicode ones you’ll probably want a hashmap instead;-). Start with all bits at 0: scan the string from the start — each time, you’ve found a duplicate if the bit corresponding to the current character is already 1 — otherwise, no duplicates yet, set that bit to 1. This is O(N).

    If you can’t allocate any extra memory, but can alter the string, sorting the string then doing a pass to check for adjacent duplicates is the best you can do, O(N log N).

    If you can’t allocate extra memory and cannot alter the string, you need an O(N squared) check where each character is checked vs all the following ones.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to implement a string-matching algorithm to determine which strings most closely match.
I am writing a class to implement an algorithm. This algorithm has three levels
I am currently trying to implement an algorithm to select a unique (16-bit) identifier.
I'm trying to implement this algorithm description from a previous question I had here
I am trying to implement the eigenface algorithm using OpenCV in VS2010. I am
i need to implement a genetic algorithm customized for my problem (college project), and
I have to implement a search algorithm in java for a school project. In
I have to implement a search algorithm for a school assignment. Right now, i'm
I want to implement a searching algorithm for sequence of words. For that i
I am trying to implement an efficient algorithm for nearest-neighbour search problem. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.