-
Recently Browsing 0 members
- No registered users viewing this page.
-
Similar Content
-
High Performance with Java ($33.99 Value) free eBook download
By News Staff,
- ebook offer
- sponsored
- (and 2 more)
- 0 replies
- 3 views
-
- 0 replies
- 2 views
-
Java and Algorithmic Thinking for the Complete Beginner ($9.99 Value) free download
By News Staff,
- ebook offer
- sponsored
- (and 1 more)
- 0 replies
- 3 views
-
Download: Java All-in-One For Dummies, 7th Edition ($27 Value) — free for your email
By News Staff,
- ebook offer
- sponsored
- (and 3 more)
- 0 replies
- 6 views
-
Unofficial script lets in-place upgrade between Windows 10 and 11 Home / Pro editions
By hellowalkman,
- microsoft
- windows 11
- (and 11 more)
- 6 replies
- 4 views
-
Question
kukubau
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
Link to comment
https://www.neowin.net/forum/topic/1327598-newbie-project-assignment-question-given-an-array-of-strings-output-the-total-number-n-of-characters-in-the-list/Share on other sites
2 answers to this question
Recommended Posts