Bird
Raised Fist0
AI for Everyoneknowledge~5 mins

Common prompting mistakes to avoid in AI for Everyone - Time & Space Complexity

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Time Complexity: Common prompting mistakes to avoid
O(n)
Understanding Time Complexity

When working with AI prompts, it is important to understand how the complexity of your prompt affects the AI's processing time.

We want to know how the AI's work grows as prompts get longer or more complicated.

Scenario Under Consideration

Analyze the time complexity of the following prompting approach.


prompt = "Tell me about cats."
response = AI.generate(prompt)

prompt = "Tell me about cats and dogs."
response = AI.generate(prompt)

prompt = "Tell me about cats, dogs, and birds."
response = AI.generate(prompt)
    

This code sends prompts of increasing length to the AI and gets responses.

Identify Repeating Operations

Look for repeated actions that affect time.

  • Primary operation: Sending the prompt to the AI and waiting for a response.
  • How many times: Once per prompt, but prompt length grows.
How Execution Grows With Input

As the prompt gets longer, the AI takes more time to process it.

Input Size (words in prompt)Approx. Operations
3Small amount of processing
6About twice the processing
9About three times the processing

Pattern observation: Processing time grows roughly in direct proportion to prompt length.

Final Time Complexity

Time Complexity: O(n)

This means the AI's work grows linearly as the prompt gets longer.

Common Mistake

[X] Wrong: "Adding more details to the prompt won't affect how long the AI takes to respond."

[OK] Correct: The AI reads and processes the entire prompt, so longer prompts take more time and resources.

Interview Connect

Understanding how prompt length affects AI processing helps you design clear and efficient prompts, a useful skill when working with AI tools in real projects.

Self-Check

"What if we split a long prompt into several shorter prompts? How would that change the time complexity?"

Practice

(1/5)
1. Which of the following is a common mistake when writing prompts for AI?
easy
A. Checking the AI's responses carefully
B. Providing clear context and examples
C. Being specific about what you want
D. Using vague or unclear questions

Solution

  1. Step 1: Understand what makes a good prompt

    Good prompts are clear and specific, helping AI understand the request.
  2. Step 2: Identify common mistakes

    Vague or unclear questions confuse the AI and lead to poor answers.
  3. Final Answer:

    Using vague or unclear questions -> Option D
  4. Quick Check:

    Vague prompts cause poor AI answers [OK]
Hint: Avoid vague questions; be clear and specific [OK]
Common Mistakes:
  • Writing broad or unclear prompts
  • Not giving enough context
  • Assuming AI knows your intent
2. Which prompt is correctly structured to avoid common mistakes?
easy
A. What do you think?
B. Tell me about stuff.
C. Explain the causes of climate change with examples.
D. Give me info.

Solution

  1. Step 1: Analyze each prompt's clarity

    The prompts "Tell me about stuff.", "What do you think?", and "Give me info." are vague or too broad without specifics.
  2. Step 2: Identify the clear and specific prompt

    Explain the causes of climate change with examples. asks for causes and examples, guiding the AI well.
  3. Final Answer:

    Explain the causes of climate change with examples. -> Option C
  4. Quick Check:

    Specific prompts guide AI better [OK]
Hint: Look for prompts with clear requests and examples [OK]
Common Mistakes:
  • Using vague words like 'stuff' or 'info'
  • Asking open-ended questions without focus
  • Not specifying what kind of answer is wanted
3. Consider this prompt: "List the benefits of exercise." What is a likely problem with this prompt?
medium
A. It is too long and complicated
B. It is too vague and lacks context
C. It uses technical jargon
D. It asks for an opinion

Solution

  1. Step 1: Evaluate the prompt's clarity

    The prompt is short and simple but does not specify details or context.
  2. Step 2: Identify the issue

    Without context, AI might give a generic or incomplete list.
  3. Final Answer:

    It is too vague and lacks context -> Option B
  4. Quick Check:

    Vague prompts cause unclear AI answers [OK]
Hint: Check if prompt gives enough detail or context [OK]
Common Mistakes:
  • Not specifying what kind of benefits to list
  • Assuming AI knows the user's intent
  • Using very short prompts without guidance
4. You wrote this prompt: "Explain AI." The AI gives a very short and unclear answer. What is the best way to fix this?
medium
A. Add more details and specify what aspect of AI to explain
B. Make the prompt shorter
C. Use slang and informal words
D. Repeat the same prompt multiple times

Solution

  1. Step 1: Identify why the answer is unclear

    The prompt is too broad, so AI doesn't know what to focus on.
  2. Step 2: Improve the prompt

    Adding details or specifying topics helps AI give a better answer.
  3. Final Answer:

    Add more details and specify what aspect of AI to explain -> Option A
  4. Quick Check:

    Specific prompts get clearer AI answers [OK]
Hint: Add details to broad prompts for better answers [OK]
Common Mistakes:
  • Using too short or broad prompts
  • Repeating prompts expecting different answers
  • Using unclear or informal language
5. You want the AI to generate a list of healthy dinner ideas but your prompt is: "Dinner ideas?" How can you improve this prompt to avoid common mistakes and get better results?
hard
A. Ask: 'Can you list 5 healthy dinner ideas with ingredients and cooking time?'
B. Just say: 'Food?'
C. Write: 'Tell me everything about dinner.'
D. Use: 'Dinner ideas' without question mark

Solution

  1. Step 1: Identify the problem with the original prompt

    "Dinner ideas?" is too short and vague, lacking details or guidance.
  2. Step 2: Choose a prompt that is clear and specific

    Ask: 'Can you list 5 healthy dinner ideas with ingredients and cooking time?' asks for a specific number of ideas, includes 'healthy', and requests ingredients and cooking time, guiding the AI well.
  3. Final Answer:

    Ask: 'Can you list 5 healthy dinner ideas with ingredients and cooking time?' -> Option A
  4. Quick Check:

    Specific, detailed prompts get better AI answers [OK]
Hint: Be specific and detailed in your prompt requests [OK]
Common Mistakes:
  • Using very short or vague prompts
  • Not specifying quantity or details
  • Assuming AI guesses your needs