• 0

[NEWBIE] Project assignment question - Given an array of strings, output the total number (n) of characters in the list


Question

Hi all

 

I have a project assignment tomorrow at noon, call it homework. I have to write an algorithm, write the pseudocode and draw a flowchart.

 

Given an array of strings, output the total number [n] of characters in the list. Basically to count all the letters that occur in my string list. All the model algorithms similar I've found are counting the occurrences of a certain letter in the string. I don't need that, I just want the number of strings to be printed, but I don't have any restrictions how many times they should occur or not.

 

Example: a = ["Tom", "has", "books"] => n = 11; for a = [] (empty array, with no elements), n = 0.

 

I am a total beginner so bare with me.

 

I have found a javascript "pseudo"code that does what I need, but I have to translate this in a layman's pseudocode and draw a diagram.

String input = ["Tom", "has", "books"];

int count = 0;
for (int i=0; i<input.length(); i++) {
    if (input.charAt(i) != ' ') {
        ++count;
    }
}
System.out.println(count);

Muchos gracias.

 

kukubau

 

2 answers to this question

Recommended Posts

  • 0

"Light travels faster than sound. That's why some people appear bright until you hear them speak."

 

1. simply looking at a few posts would have informed you that help on homework is not likely to happen unless you are bright enough to phrase a question so it appears like a "real world" problem.

 

2. Flowcharts have not been spotted since the 1970's and those golden years of IBM Mainframes, so unless you own a T.A.R.D.I.S, and have a regular consulting gig back in the 1950's at UNIVAC, save some neurons and paper and aggravation and yeah there is always "that guy" who pulls out a flowchart in 2017 and everyone groans. Do you want to be That Guy?

 

3.  Pseudocode still has a tiny core of retro holdouts that are still trying to channel the spirit of PASCAL but unless you have a sister that cries a lot, do you really want to join the Lost Boys? (https://www.youtube.com/watch?v=mrMLMV6E4CM)

This topic is now closed to further replies.
  • Posts

    • Tim Cook: "The US over time began to stop having as many vocational kinds of skills." What's the point of wasting time getting those skills if you can't get a job with them? Good Lord, maybe he and his cohort of CEO's who exported all these jobs to China should just shut the f**k up :D
    • I made a new Cinematic/Trailer for the game, this will be the intro, still a work in progress!  I also updated the Steam page with a ton of new screenshots! 👀 https://store.steampowered.com/app/3925340/Incoherence_Dark_Rooms/  
    • Closed-loop cooling and a custom 800G network protocol let the $7.3B campus run as one AI training machine. Microsoft confirmed June 23, 2026, that its Fairwater campus in Mount Pleasant, Wisconsin, is fully operational — and the engineering behind it makes the facility something fundamentally different from every data center that came before it. Where conventional cloud infrastructure racks up general-purpose servers and parcels out workloads to each one independently, Fairwater links hundreds of thousands of NVIDIA GB200 Blackwell GPUs into a single, coherent cluster using a two-story building design, 800-gigabit-per-second Ethernet fabric, and a proprietary networking protocol co-developed with OpenAI and NVIDIA. The result, according to Microsoft, is the closest thing to a purpose-built AI supercomputer that any company has ever placed in commercial operation. https://www.techtimes.com/articles/319205/20260627/microsoft-opens-fairwater-wisconsin-ai-campus-runs-one-supercomputer-via-800g-ethernet.htm  
  • Recent Achievements

    • Conversation Starter
      jessse3334 earned a badge
      Conversation Starter
    • Reacting Well
      JuvenileDelinquent earned a badge
      Reacting Well
    • One Month Later
      Excellence2025 earned a badge
      One Month Later
    • Week One Done
      Excellence2025 earned a badge
      Week One Done
    • Week One Done
      flexorcist earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      501
    2. 2
      +Edouard
      211
    3. 3
      PsYcHoKiLLa
      150
    4. 4
      Steven P.
      73
    5. 5
      macoman
      62
  • Tell a friend

    Love Neowin? Tell a friend!